Hello
Hello

Reputation: 2265

How to stop animation of a specific movieclip

I've created an animation (right click on timeline and create animation) and given it an object name. If I call tank.stop(), the animation will stop successfully. However, if I call tank.body.stop(), it won't work.

There are 2 object names - the movieClip object name AND the name of the animation itself. I don't know how to stop animating a specific part, not all the parts. If I write tank.animObjectName.stop(), I get an error.

// If I stop animating the main movieclip then all the child will stop 
// animating also
main movieclip ->
{ 

  head //how to stop animating head?

  body //how to stop animating body?

  legs //how to stop animating legs?


}

Upvotes: 0

Views: 2259

Answers (1)

Smolniy
Smolniy

Reputation: 456

Created from context menu animations are instances of AnimatorFactory class. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/motion/AnimatorFactory.html

There is no ability to control them (start/stop).

You need use classic scheme of movieclip tree. Root - main movieclip with all content. Every animated part is a movieclip with animation inside root clip. Example:

tank (no animation, only child movieclips, 1 frame at all)
--body (movieclip with animation of body inside)
--weapon (movieclip with animation of gun inside)
--banner (movieclip with animation of banner inside)

To stop body, write tank.body.stop(); Body will paused, but weapon and banner will play. When you want to stop all parts, write command for all parts:

tank.body.stop();
tank.weapon.stop();
tank.banner.stop();

If you have some animations and want to convert them to movieclip:

  1. Select frames of your amination with mouse. You can select frames in many layers simultaneously, use SHIFT key etc
  2. In context menu select Cut frames
  3. Create new movieclip in library
  4. Select 1st frame, in context menu select Paste frames
  5. Return to main movieclip, create layer if need
  6. Drag movieclip from library (step 3) into frame, place in proper position

Maybe there are faster method, but i don't know them...

Upvotes: 1

Related Questions