Globmont
Globmont

Reputation: 1

Flash CS4, AS3 animation issue

I was making an animation in flash cs4 and i was making a play/pause button. Everything pauses when clicked but the play button gives me an issue. I have some movie clips with animations in them so when i tell them to play, instead of resuming where they were, they play regardless of whether or not they should be playing. Is there a way to fix this?

Upvotes: 0

Views: 518

Answers (3)

Raj A.N.T. Gounder
Raj A.N.T. Gounder

Reputation: 500

If you want resume option, just do simple work.

  • While pausing catch the frame number into a number

If mc is your movieClip,

>   mc.stop();<br> var
> mcFrameNumber:Number = mc.currentFrame;
  • Then when playing again,use
mc.gotoAndPlay(mcFrameNumber);

It will work.

Upvotes: 0

player_03
player_03

Reputation: 430

Depending on what you're trying to accomplish, you may want to switch your movie clips to graphics.

A movie clip object will play on its own, completely ignoring whether its parent is playing or stopped. A graphic, on the other hand, will only play when its parent is playing, and in fact is locked to its parent's timeline. That is, if you have the parent go back one frame, the graphic will go back a frame as well.

Upvotes: 0

gltovar
gltovar

Reputation: 447

you could try recursively going though all the movieclips in a moveclip and stoping them, from there modifiying the below's link source to play wouldn't be too bad either.

http://www.auricom.com/devote/using-recursion-to-perform-an-action-on-all-displayobject-children

one thing in the the above link, is if there is a sprite with a movieclip his code wouldn't traverse into a the sprite, here is a small mod for his code to catch that:

private function stopAllMovieClips(mc:*) : void {

        trace("Stop: ", mc.name);

         if(mc is MovieClip) mc.stop();

         for (var i:int = 0; i < mc.numChildren; i++) 
         if (mc.getChildAt(i) is DisplayObjectContainer){  /// here is the mod
                      stopMovieClip(mc.getChildAt(i));
                 }

}

stopAllMovieClips(this);

Upvotes: 1

Related Questions