Hi.
I’m new to Flex and am trying to do simple experiments to make sure I’ll be comfortable making the switch from Flash to Flex for my next project.
I have many .fla’s for UI controls that I want to continue to use and so I want to make sure I can easily access and control the ui components in their .swf’s from flex. I don’t have code in these ui components, but I need to be able to do simple things like play, stop, modify properties, etc.
The following code works great when I want to access a MovieClip inside my .swf:
[Embed(source = "ui.swf", symbol = "uiobj")] var UIObj:Class;
var newObj:Sprite = new UIObj();
addChild(newObj);
var misc_mc:MovieClip = MovieClip(newObj.getChildByName("misc_mc"));
// now with misc_mc I can do stuff like set properties and call methods, etc.
misc_mc.width = 100;
misc_mc.gotoAndStop(100);
// THE PROBLEM ....
// When I have a text field as a child of the uiobj MovieClip, I can't seem to get a handle to it
var misc_txt:TextField = TextField(newObj.getChildByName("misc_txt"));
name_txt.width = 20;
name_txt.text = "Change the text";
// NOPE ... either line above fails
Anyone see what I’m doing wrong? Or anyone have a more simple way to get a handle to the textfield components inside an embedded .swf?
Thanks in advance!