views:

442

answers:

2

How can I embed some characters one time, and have them embedded in all my dynamic textfields?

A: 

If you're using the Flash IDE, you can use JSFL to automatically embed characters in textfields. Here is an example.

bzlm
+2  A: 

I don't think you can do that by default, but you can do something close: 1. You go to the library, select "new font". 2. You pick your font, for example "Myriad Pro", check the "export for Actionscript" checkbox. You get a message about a class not existing and being generated at runtime - you press "OK" and don't worry. 3. When you define your dynamic textfields, you do the following:

var textFormat:TextFormat = new TextFormat();
textFormat.font = 'Myriad Pro';
textBox.setTextFormat(textFormat);
textBox.defaultTextFormat = textFormat;

Of course, you only need to define the textFormat once, if no differences in size or other attributes exist. The setTextFormat(textFormat) applies for the text already in the textbox, whereas the defaultTextFormat applies for the text that's going to be added from that point on to the textbox.

That should do the trick. Tested in Flash CS4.

evilpenguin