Copy link to clipboard
Copied
so in as2 we can do that by using _root, but now in as3 I have no idea how to refer it it right now, I tried, root., parent.parent.children, stage, and also MovieClip(root), but it's just not tracking the variable, I also tried tracking from the root, mc.parent it say parent doesn't belong to the number variable, I've tried the same method for MC, it give me the MainTimeLine, so I also tried MainTimeLine.MC, it still doesn't work. anyone knows how? thanks.
cast the parent or root as a movieclip:
MovieClip(parent).yourvar
or
MovieClip(root).yourvar
Copy link to clipboard
Copied
cast the parent or root as a movieclip:
MovieClip(parent).yourvar
or
MovieClip(root).yourvar
Copy link to clipboard
Copied
ohh I know what my problem was now. I tried to put var infront of MovieClip(root).yourvar. thanks it works now. ^^
Copy link to clipboard
Copied
what if I want to access to the movieclip that were originally on the stage?
Copy link to clipboard
Copied
with a displayobject (like a movieclip) you can always use getChildByName or getChildAt applied to the movieclip's parent:
mc_reference.parent.getChildByName(mc_reference.name); // but if you already know the reference name, just use it to access the movieclip
in addition, for objects created during authoring, you can use the dot code above (similar to as2 dot notation):
MovieClip(mc_instancename.parent).mc_instancename;