We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

chrisaiv on 01/30/08


Tagged

css as2


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

jmelgoza
crashdr


AS2 internal CSS Parsing


Published in: ActionScript 


  1. //A. Create CSS as a String
  2. var css:String = ".headline {color: #FFCCCC; font-size: 18px}, p {color: #666666; font-size: 14px; font-weight: bold;}";
  3.  
  4. //B. Create a new Style Sheet & Parse the CSS
  5. var ss = new TextField.StyleSheet();
  6. ss.parseCSS(css);
  7.  
  8. //C. Create Some Strings
  9. var headline:String = "<span class='headline'>Header 1</span><br>";
  10. var p:String = "<p>lorem ipsum.....</p>";
  11.  
  12. //D. Create a Dynamic Text Field
  13. var text_txt:TextField = this.createTextField("text_txt", this.getNextHighestDepth(), 0, 0, 100, 50);
  14. text_txt.multiline = true;
  15. text_txt.wordWrap = true;
  16. text_txt.html = true;
  17. text_txt.styleSheet = ss;
  18.  
  19. //E. Bind
  20. text_txt.htmlText = headline + p;

Report this snippet 

You need to login to post a comment.