Skip to main content
TheOriginalGC
Community Expert
Community Expert
March 10, 2025
Question

Problem with nested movie clip animation

  • March 10, 2025
  • 1 reply
  • 612 views

I'm converting a program from AS3 to JavaScript and I'm running into a problem. I have a movieclip with 3 different frames, each playing a different animation. I want to switch from one animation state to another like it does in AS3. When I first play the clip, I use:

myMC.on('tick',function(){ this.gotoAndStop(0);} );

and it plays the animation in the first frame perfectly. However, when I use the same code to switch to another frame, such as:

myMC.on('tick',function(){ this.gotoAndStop(1);} );

The animation clip doesn't play - the movie clip stays on the first frame. It's as if the act of switching to one of the other nested movieclips breaks the animation playback. Any ideas? 

    1 reply

    kglad
    Community Expert
    Community Expert
    March 10, 2025

    why are you showing code for two different movieclips?

     

    p.s.  the usual problem is caused by the use of "this"

    TheOriginalGC
    Community Expert
    Community Expert
    March 10, 2025

    Human error in posting. Supposed to be the same.

     

    I tried removing 'this' and it caused the whole thing to freeze up when switching to a different animation.

    kglad
    Community Expert
    Community Expert
    March 10, 2025

    you can't just remove "this" and expect something to work.  you need to define "this".