Text formatted with an external style sheet : StyleSheet : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » StyleSheet »

 

Text formatted with an external style sheet


 
package {
  import flash.display.*;
  import flash.text.*;
  import flash.events.*;
  import flash.net.*;

  public class Main extends Sprite {
    public function Main (  ) {
      var urlLoader:URLLoader = new URLLoader(  );
      urlLoader.addEventListener(Event.COMPLETE, completeListener);
      urlLoader.load(new URLRequest("styles.css"));
    }

    private function completeListener (e:Event):void {
      var styleSheet:StyleSheet = new StyleSheet(  );
      styleSheet.parseCSS(e.target.data);

      var t:TextField = new TextField(  );
      t.width = 200;
      t.styleSheet = styleSheet;
      t.htmlText = "<p>ActionScript is fun!</p>";

      addChild(t);
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» StyleSheet


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0