Skip to main content
Inspiring
April 8, 2017
Answered

Animate CC HTML5/Canvas how to control a nested MovieClip timeline

  • April 8, 2017
  • 1 reply
  • 7281 views

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?

This topic has been closed for replies.
Correct answer sdenec

Heureka! I found the solution, thanks to this post javascript - HTML5 Canvas / Flash. How to access children movie clip and make it gotoAndPlay? - Stack Overflow

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


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!

1 reply

Legend
April 10, 2017

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.

sdenecAuthor
Inspiring
April 10, 2017

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.

Legend
April 10, 2017

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.