add css to flash textfield


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.