Revision: 44787
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 18, 2011 14:53 by tuffstudio
Initial Code
function recursiveEmbed(container : DisplayObjectContainer) : void { for(var i: int = 0; i < container.numChildren; i++) { var child : DisplayObject = container.getChildAt(i); if(child is DisplayObjectContainer) recursiveEmbed(child as DisplayObjectContainer); else if (child is TextField) TextField(child).embedFonts = true; } } //// You can use it like this on your root movieclip or Document Class or whatever: //// recursiveEmbed(this)
Initial URL
Initial Description
Well….the truth is: the way Flash deals with font managing just suck! Normally, you’ll have to export the font’s characters. To do this follow these steps: On the Main Menu go to Text -> Font Embeding Click on the + thing and add a new font. Give a name to the font Select the font on the combobox, and select which group of characters to be exported. Tip: Be sure to select only the characters you’ll actually use (it doesn’t make sense to export Japanese characters to a brazilian website, right?), because flash will export them on the SWF and this will increase filesize. 5. Go to the actionscript tab and select “Export for Actionscript†Tip: This is actually optional, but if you are doing a lot of actionscript coding, it’s good to do this because you can use the font asset as an actionscript object and initialize with the new keyword and everything. 6. Select the Textfield you want that font for and type the name of the font you set on step 3. Notice that Flash will put an * after the font name. This is just to identify the font as a library asset. Now there’s the trick. For every dynamic textfield you have, you must set TextField.embedFonts = true to it’s instance.
Initial Title
AS3 recursive font embed
Initial Tags
Initial Language
ActionScript 3