We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

chrisaiv on 11/08/07


Tagged

stylesheet styles


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

copyleft
Akuma99
outbox


AS3: Adding styles to a TextArea component using new TextFormat()


Published in: ActionScript 3 


Confusing but here's the rule. TextFields can use stylesheets. TextArea or TextInput need a new TextFormat()


  1. var textAreaFormat:TextFormat = new TextFormat();
  2. textAreaFormat.size = 30;
  3. textAreaFormat.italic = true;
  4.  
  5. var ta:TextArea = new TextArea();
  6. ta.x = 100;
  7. ta.y = 100;
  8. ta.width = 300;
  9. ta.height = 300;
  10. ta.setStyle("textFormat", textAreaFormat);
  11. ta.htmlText = "This is text within a text area";
  12. addChild(ta);

Report this snippet 

You need to login to post a comment.