Copy link to clipboard
Copied
Object(root).my_movieclip2.my_movieclip3.my_movieclip24.gotoAndPlay(18);
not working,,,
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now