- I’ve created a MovieClip and placed a Dynamic Text into this clip. I’ve named the text “text_txt”;
- I’ve exported my MovieClip for action script (made it a class) and gave it name “ImageContainer”; And I deleted MovieClip prototype from stage (to create it dynamically later)
- On main time line in frame 1 I’ve placed code:
var clip_mc:ImageContainer = new ImageContainer(); clip_mc.name = "myClip"; addChild(clip_mc); getChildByName("myClip").text_txt.text = "blabla";
And it gives me error:
1119: Access of possibly undefined property text_txt through a reference with static type flash.display: DisplayObject.
Question: Can I create kind of prototype Clip with some fields (like dinamic text) to reference them later? Where is my mistake?
ADDED: I’ve found interesting thing: if I turn off the “Strict Mode” in Publish/Flash/AsctionScript3.0 - everything works fine!
**ADDED: **Ha, everything was easy! I should just change one string like this:
MovieClip(getChildByName("myClip")).text_txt.text = "doh";
When I placed MovieClip in the beginning everything works fine with Strict Mode! Problem has been solved