package { import flash.display.*; import flash.text.*; import flash.events.*; import flash.net.*; public class actionscript_misc_StyleSheetLoadingDemo extends Sprite { private var bookStyle:StyleSheet; private var styleSource:String; private var bookContent:XML; public function actionscript_misc_StyleSheetLoadingDemo () { var urlLoader:URLLoader = new URLLoader(); urlLoader.addEventListener(Event.COMPLETE, completeListener); urlLoader.load(new URLRequest("actionscript-misc-styles.css")); bookContent =

ActionScript Basics

This chapter covers the following topics:

  • variables
  • functions
  • To create a variable, we use the keyword var. The following code demonstrates:

    var x:int = 10;

    For more information, visit this web site.

    } private function completeListener (e:Event):void { styleSource = e.target.data; start(); } private function start ():void { bookStyle = new StyleSheet(); bookStyle.parseCSS(styleSource); var t:TextField = new TextField(); t.multiline = true; t.wordWrap = true; t.styleSheet = bookStyle; t.width = 400; t.height = 300; t.border = true; t.background = true; t.condenseWhite = true; t.htmlText = bookContent.toXMLString(); addChild(t); } } }