Posted By

peterbelsky on 01/27/11


Tagged


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

kure69
CammoKing
dubogii
kevinv033


add css to flash textfield


 / Published in: ActionScript 3
 

  1. var cssLoader:URLLoader = new URLLoader();
  2.  
  3. var cssRequest:URLRequest = new URLRequest("content.css");
  4.  
  5. var sheet:StyleSheet = new StyleSheet();
  6.  
  7. cssLoader.load(cssRequest);
  8.  
  9. cssLoader.addEventListener(Event.COMPLETE, cssLoadComplete);
  10.  
  11.  
  12.  
  13. function cssLoadComplete(event:Event):void
  14.  
  15. {
  16.  
  17. //trace(cssLoader.data);
  18.  
  19. sheet.parseCSS(cssLoader.data);
  20.  
  21. // Now assign the StyleSheet to a text field for example
  22.  
  23. textBox.styleSheet = sheet;
  24.  
  25. //textBox.text = styles.texttitle;
  26.  
  27.  
  28. // Now you would load any external text or html into
  29.  
  30. // the text field
  31.  
  32. }

Report this snippet  

You need to login to post a comment.