Skip to main content
Participant
July 30, 2018
Answered

How to make movieclip stay in frame?

  • July 30, 2018
  • 3 replies
  • 423 views

I'm using HTML5 Canvas.

This is frame 1 of the main timeline and there is one movieclip.

this.myMovieclip.gotoAndStop(24);

this.gotoAndStop(2);

/*

Do some stuff here

...

*/

this.gotoAndStop(1);

Now that I am back at frame 1 of the main timeline the movieclip is no longer at frame 24 and it starts playing from 0. I'm pretty sure that this didn't happen in as3...

Thanks for helping.

This topic has been closed for replies.
Correct answer ClayUUID

Why don't you just put this.gotoAndStop(24); in the first frame of myMovieclip itself?

Well anyway, there's a fair bit of discussion in this thread on the subject of accessing uninitialized movie clips:

Re: Accessing movieClip.children array Animate CC Canvas

3 replies

ClayUUIDCorrect answer
Legend
August 3, 2018

Why don't you just put this.gotoAndStop(24); in the first frame of myMovieclip itself?

Well anyway, there's a fair bit of discussion in this thread on the subject of accessing uninitialized movie clips:

Re: Accessing movieClip.children array Animate CC Canvas

Participant
August 2, 2018

I think I know what the problem is. If you look ate the js file exported (projectname.js) it looks like the movieclip is assigned after the main timeline function.

Because if I immediately do this.myMovieclip.gotoAndStop(24) it won't work. But if i do:

setTimeout(function () {

     this.myMovieclip.gotoAndStop(24);

}, 5000);

it stops. Still don't know how to stop it immediately and avoid it starting from 0, though.

kglad
Community Expert
Community Expert
August 3, 2018

delay by 100ms.

kglad
Community Expert
Community Expert
July 31, 2018

comment all your code except the first line.  is this.myMovieclip on frame 24 (or 25)?

Participant
August 2, 2018

I actually mentioned something wrong. I'm not stopping the movieclip from the main timeline because "this.myMovieclip.gotoAndStop(24);" simply just doesn't do anything. I'm stopping at the frame of the movieclip itself. My problem is that it will always start from 0 when I come back to the frame it was created.