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

how to call child movieClip within childMovie clip by others layer MovieClips.

Guest
Jul 01, 2014 Jul 01, 2014

Object(root).my_movieclip2.my_movieclip3.my_movieclip24.gotoAndPlay(18);

not working,,,

TOPICS
ActionScript
495
Translate
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
LEGEND ,
Jul 01, 2014 Jul 01, 2014

Does the code work if you place it on the main timeline and remove the root reference?

It is more proper to have the code that commands child objects in the main/parent timeline rather than trying to target back thru the parent.  If you have the object dispatch and event and have a listener for that event in the main timeline, then you can have the main timeline retain control of its child objects.

Translate
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
Guide ,
Jul 01, 2014 Jul 01, 2014
LATEST

Assuming you do get this to work the way you're asking, what happens when the structure of my_movieclip2 or my_movieclip3 changes? You're either going to have to search through and find every place that references them or you're going to wind up in a situation where you're scared to make any changes because of the sheer amount of work that's involved.

A more robust approach is to do this:

dispatchEvent('someEvent', true);//true says "bubble this up the display list"

then in movieclip24, something like

stage.addEventListener('someEvent', onSomeEvent);

function someEvent(e:Event):void {

     gotoAndPlay(18);

}

Note that in my own work I wouldn't do it this way, but you have to start somewhere in terms of understanding concepts.

Translate
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