开发者

How I can access in Actionscript the "text" property of a TLF text created in the Flash IDE

开发者 https://www.devze.com 2023-01-18 04:49 出处:网络
I created a TLF Text with the Flash IDE in the main document. I\'ve assigned it an instance name with the IDE

I created a TLF Text with the Flash IDE in the main document.

I've assigned it an instance name with the IDE

When 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 expected

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号