How I can access in Actionscript the "text" property of a TLF text created in the Flash IDE
I created a TLF Text with the Flash IDE in the main document.
I've assigned it an instance name with the IDEWhen I try to access the text with Actionscript I cannot access the text field.
Of course if I transform in the IDE the text in classic dynamic text it works as expectedI feel very stupid and I suspect it has an obvious solution but I cannot find any info about the subject
// instance name is "myText"
trace(this.myText);
>> null
trace(this.getChildAt(0));
>> [o开发者_C百科bject Movie Clip]
trace(this.getChildbyName("myText"));
>> null
The following code might be of help.
var markup:XML =
<TextFlow xmlns='http://ns.adobe.com/textLayout/2008'>
some text...
</TextFlow>;
var flow:TextFlow = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT);
var sprite:Sprite = new Sprite();
flow.fontFamily = 'font name...'
flow.flowComposer.addController(new ContainerController(sprite, width, height));
flow.flowComposer.updateAllControllers();
parent object.addChild(sprite);
sprite.x = some
sprite.y = where
I think you work on the flash class.
I cannot access the TLF Text instance on flash class code but it works on ActionScript in frame. Edit the code in ACTIONS - FRAME.
精彩评论