• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

referring to the variable on the main timeline from child?

Explorer ,
Nov 28, 2012 Nov 28, 2012

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.

TOPICS
ActionScript

Views

672

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 28, 2012 Nov 28, 2012

cast the parent or root as a movieclip:

MovieClip(parent).yourvar

or

MovieClip(root).yourvar

Votes

Translate

Translate
Community Expert ,
Nov 28, 2012 Nov 28, 2012

Copy link to clipboard

Copied

cast the parent or root as a movieclip:

MovieClip(parent).yourvar

or

MovieClip(root).yourvar

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2012 Nov 28, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2012 Nov 28, 2012

Copy link to clipboard

Copied

what if I want to access to the movieclip that were originally on the stage?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2012 Nov 29, 2012

Copy link to clipboard

Copied

LATEST

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines