/ Published in: ActionScript 3

So from what I can tell, you can't style a TextArea or a TextInput component using a new StyleSheet(). Instead you need to use a new TextFormat().
Expand |
Embed | Plain Text
var tf:TextFormat = new TextFormat(); tf.size = 25; tf.color = "#FEFEFE"; var ti:TextInput = new TextInput(); ti.x = 100; ti.y = 100; ti.width = 200; ti.height = 30; ti.htmlText = "<p>Snippler Rocks!</p>"; ti.setStyle("textFormat", tf); addChild(ti);
Comments

You need to login to post a comment.
Error in line 3. Should be: tf.color = "0xFEFEFE";
while trying to find a solution I stumbled on your post. This was not satisfying enough for me so we wrote a new solution overcoming the problem of not being able to load a stylesheet. see: http://www.sharedknowhow.com/2008/07/fixed-flash-textarea-css-incompatibility/
drommels: Thank you for both your contribution and explanation: it's simple, elegant, and extremely handy. I actually can't believe Adobe didn't bother to make TextArea work with StyleSheet, maybe it was an oversight. Regardless, I look forward to seeing many more of your contributions.