123 posts
  • Has been part of the Envato Community for over 6 years
  • Has sold $10,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more

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.”;


myText.border = false;

myText.wordWrap = true;

myText.selectable = false;

myText.width = 520;

myText.height = 60;

1685 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
4140 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Located in Brazil
+4 more

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 ….

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes