PDA

View Full Version : Trouble dynamically loading fonts


Moge
08-28-2008, 08:39 PM
I'm making an application that allows the user to choose from a font list. I don't want to have to embed all the fonts because that would be huge. So I'm creating a swf for each font which has a dynamic text field with that font embedded named txtField. When the user chooses a font, I load that swf.

Problem is that I have no idea how to now access that textField. When I trace the loaded swf's child name, I get "instance 23", not the instance name I gave it in the authoring environment (txtField). And when I try to set the text, I get a "possibly undefined blah blah" error.

So how do I get access to the dynamic text field in a loaded swf?

tarafenton
08-28-2008, 09:22 PM
Give it a name but reference using getChildByName

getChildByName("dynamicText").text

tank
08-28-2008, 09:32 PM
If you are using the Loader class, on complete you can get the property "event.target.content" which gives you the main timeline of the loaded object. So if you do something like this, you should get the text field:


function completeHandler( event : Event )
{
trace(event.target.content.txtField);
}