1
votes

I have a movieclip which I have named "char" as an instance name witch has 4 frames inside of it, all named "W" and en each of these 4 frames I have movieclips which play a charcater walking.

In my source code you can see I have a gotoAndPlay(2) method but when I debug without any errors or warnings it only plays one frame, frame 2, Instead of playing all the frames from frame 2 as its supposed to.

    if (iswalking == true)
 {
  char.w.gotoAndPlay(2);
  trace("running");
 }
 else
 {
  char.w.gotoAndStop(1);
 }

Please help I've been stuck on this for ages

2
Are you sure you don't have any calls to stop() in the animation? How are you calling the code you posted? If it's called each frame for example, it would go to frame 2 each frame, resulting in it appearing to be stopped at frame 2. - Jonatan Hedborg
is there a chance you have a stop(); on the 2 frame - shannoga

2 Answers

1
votes

Are you using this code in a loop? If so then each iteration of the loop will cause the movieclip to jump to frame 2.

Try the following code:-

if (iswalking == true)
 {
  char.w.nextFrame();
  trace("running");
 }
 else
 {
  char.w.gotoAndStop(1);
}
0
votes

Try removing the 'w' frame labels from all 4 frames. (if I've understood you correctly)

 if (iswalking)
 {
  char.play();
  trace("running");
 }
 else
 {
  char.gotoAndStop(1);
 }