Copy link to clipboard
Copied
Hi,
I have a problem i can't seem to wrap my head around.
I created a Movieclip with several frames and on each frame is another nested movieclip and ocasionally that also contains other movieclips (all with instance names while the mainMc is added via addChild() to the stage).
so "mainMc > subMc > subSubMc"
Now i try to control the timeline of the subMc, respectively the subSubMc
I figuered it would be easy as
mainMc.stop(); or
mainMc.gotoAndStop('label');
works like a charm.
If i try to control the timeline like
mainMc.subMc.stop(); or any timeline command absolutely nothing happens. the MC keeps looping (stage.update(); is ticking);
The console doesn't throw any errors and it works absolutely fine if i try to do any other operations o a nested mc - line alpha, rotation, coordinates etc.
Why the heck can't i control the timeline?
Help please? Anyone?
1 Correct answer
Man, so much helpful people!
To set things right the actually is an even simpler solution thanks to this guy Animate CC HTML5/Canvas controling a nested MovieClip timeline with actionscript - Stack Overflow
It seems to be an animate cc bug! You have to set the mainMc to gotoAndStop(0); first! Do not make the mistake of thinking stop(); would work here - as i did!
Copy link to clipboard
Copied
Are you trying to issue these commands on the very first frame the nested clips exist? Because that's likely not going to work. Animate instantiates clips top-down, so the top level code will be trying to issue commands to clips that don't exist yet. If you want a movie clip to reliably start stopped, you have to put a this.stop(); in its first frame.
Copy link to clipboard
Copied
Thank you for your reply.
Technically yes, I put the whole code on the first frame of my project.
What i don't get is why I can change all other properties without any problem.
If I put the stop-command directly in the nested movieclip it works without a problem. But then I still can't use the start or gotoAnd... commands. As I stated it works totally finde with movieclip-instaces i add via addChild to the stage - even in the first frame ... just nested movieclips won't respond.
Copy link to clipboard
Copied
You can change properties because controlling a clip's timeline is handled differently internally than just setting a property.
It works fine with addChild because that command fully instantiates the clip before control is returned to the calling code.
Copy link to clipboard
Copied
Your input is much welcomed
Is there any possibilty to reinstatiate the nested clips so the timeline works? I need to use the gotoAndStop() command a lot and it would be so much easier if I could control the timeline without creating Containers and adding/removing every single instance when needed ...
Copy link to clipboard
Copied
I have no idea what "reinstatiate" is supposed to mean.
You can control nested clips without issue by just waiting until the frame after they first appear. If that would cause visual issues, you can have them start hidden or off-stage.
Copy link to clipboard
Copied
hmm,
well I thought it might be possible to somehow tell the nested mc to recognise the timeline properties as addChild seems to do the trick for the main mc. But maybe I don't get how things work^^
I really appreciate you taking time to try an solve my problem. The thing with your solution is that i don't have frames. I just use the IDE to build my assets. Everything else is assembled in javascript by taking the assets from the library and using addChild. So there is no second frame. Even if I add an update.stage() directly after placing the main mc it is still impossible to control the timeline of the sub mcs. I'm at a total loss here. Funny thing is that nowhere is an answer to my question. I can't believe I'm the first to try this stuff^^
well, i guess i somehow have to rely on another way to achive what i want
Copy link to clipboard
Copied
Heureka! I found the solution, thanks to this post javascript - HTML5 Canvas / Flash. How to access children movie clip and make it gotoAndPlay? - Stac...
You can manipulate nested mcs on events! so if you use for example
mainMc.on('tick',function(){ this.subMc.gotoAndStop(1);} );
it actually works - I'll be damned.
ClayUUID - Thanks you for your time but this sollution was exaactly what I needet, at least it works for the time being
Copy link to clipboard
Copied
Man, so much helpful people!
To set things right the actually is an even simpler solution thanks to this guy Animate CC HTML5/Canvas controling a nested MovieClip timeline with actionscript - Stack Overflow
It seems to be an animate cc bug! You have to set the mainMc to gotoAndStop(0); first! Do not make the mistake of thinking stop(); would work here - as i did!
Copy link to clipboard
Copied
Yes, ticks and frames are synonymous spans of time in Canvas.

