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


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

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().


Copy this code and paste it in your HTML
  1. var tf:TextFormat = new TextFormat();
  2. tf.size = 25;
  3. tf.color = "#FEFEFE";
  4. var ti:TextInput = new TextInput();
  5. ti.x = 100;
  6. ti.y = 100;
  7. ti.width = 200;
  8. ti.height = 30;
  9. ti.htmlText = "<p>Snippler Rocks!</p>";
  10. ti.setStyle("textFormat", tf);
  11. addChild(ti);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.