Revision: 4541
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 3, 2008 12:33 by chrisaiv
Initial Code
/*************************************** Initialize Variables ***************************************/ var tf:TextField = new TextField(); tf.width = stage.stageWidth; tf.height = stage.stageHeight; addChild(tf); var wordList:Array = new Array(); var textLoader:URLLoader = new URLLoader(); textLoader.addEventListener(Event.COMPLETE, textLoaded); var cssLoader:URLLoader = new URLLoader(); var css:StyleSheet = new StyleSheet(); /*************************************** Parse Text + Apply External CSS ***************************************/ function cssLoaded(e:Event):void{ css.parseCSS(e.target.data); tf.styleSheet = css; for(var i:int = 0; i < wordList.length; i++){ tf.htmlText += "<h4>" + wordList[i] + "</h4>"; } } function textLoaded(e:Event):void{ wordList = e.target.data.split("\n"); cssLoader.load(new URLRequest("http://www.channelone.com/css/flash_block.css")); cssLoader.addEventListener(Event.COMPLETE, cssLoaded); } textLoader.load(new URLRequest("http://www.channelone.com/fun/swf_band_name_txt.txt"));
Initial URL
Initial Description
Here is an intermediate example of how to load an external .txt file and apply an external .css
Initial Title
AS3: Load external .txt and .css
Initial Tags
Initial Language
ActionScript 3