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

How to make movieclip stay in frame?

New Here ,
Jul 30, 2018 Jul 30, 2018

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.

390
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

correct answers 1 Correct answer

LEGEND , Aug 03, 2018 Aug 03, 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

Translate
Community Expert ,
Jul 31, 2018 Jul 31, 2018

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

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
New Here ,
Aug 02, 2018 Aug 02, 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.

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
New Here ,
Aug 02, 2018 Aug 02, 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.

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
Community Expert ,
Aug 03, 2018 Aug 03, 2018

delay by 100ms.

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 ,
Aug 03, 2018 Aug 03, 2018
LATEST

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

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