ActiveDen

AS3 Dynamic Text Field Name

102 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 1 000 and 5 000 dollars
  • United States
egobuilders says

Is there a way in AS3 to give a dynamically created text field a dynamic name? For example, in AS2 I could name things like this: _root.myText[myVar] ...but I can’t seem to do this in AS3 . I need to reference the text field by the value of myVar… Also, if anyone knows how I can use bold and italic tags in the text, that would be cool too! .htmlText doesn’t seem to do the trick. Thanks!

var myFont = new Font1();

var myFormat:TextFormat = new TextFormat();

myFormat.size = 19;

myFormat.leading = 3;

myFormat.align = TextFormatAlign.LEFT;

myFormat.font = myFont.fontName;

var myText:TextField = new TextField();

myText.defaultTextFormat = myFormat;

myText.embedFonts = true;

myText.antiAliasType = AntiAliasType.ADVANCED;

myText.htmlText = “This is the text.”;

addChild(myText);

myText.border = false;

myText.wordWrap = true;

myText.selectable = false;

myText.width = 520;

myText.height = 60;

1664 posts
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Author had a Free File of the Month
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
+1 more
Tean says
4126 posts
  • Bought between 1 and 9 items
  • Brazil
  • Community Superstar
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
tsafi says

You need to look good on the forum search, we put a lot of good resource here at the past regarding this topic, i myself include some simple class regarding this topic and bitfade also.

Regarding how you can use bold and italic…. many think by just adding the tags like html it will do the trick,well…..it’s not enough, you actually need to embed the Fonts as a bold or as italic also , that’s how you do it the right way ….

by
by
by
by
by