Posted By

chrisaiv on 01/30/08


Tagged

css as2


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

crashdr


AS2: Parsing External CSS file


 / Published in: ActionScript
 

  1. /*************
  2. ActionScript In Flash
  3. *************/
  4. //A. Create a new Style Sheet
  5. var ss = new TextField.StyleSheet();
  6. var headline:String = "<span class='headline'>Header 1</span><br>";
  7. var p:String = "<p>lorem ipsum.....</p>";
  8. //B. Create a Dynamic Text Field
  9. var text_txt:TextField = this.createTextField("text_txt", this.getNextHighestDepth(), 0, 0, 100, 50);
  10. text_txt.multiline = true;
  11. text_txt.wordWrap = true;
  12. //C. Load the external CSS
  13. ss.load("./YourExternalFile.css");
  14. ss.onLoad = function(success) {
  15. if (success)
  16. {
  17. text_txt.styleSheet = ss;
  18. text_txt.text = headline + p;
  19. }
  20. };

Report this snippet  

You need to login to post a comment.