Flash CS3  |  Go to CS4 Help

Copy motion as ActionScript

Copy the properties that define a motion tween in the Timeline as ActionScript 3.0 and apply that motion to another symbol, either in the Actions panel or in the source files (such as class files) for a Flash document that uses ActionScript 3.0.

Use the fl.motion classes to customize the Flash-generated ActionScript for your specific project. For more information, see the fl.motion classes in the ActionScript 3.0 Language and Components Reference.

Copy Motion As ActionScript 3.0 can capture the following properties of a motion tween:

  • Position

  • Scale

  • Skew

  • Rotation

  • Transformation Point

  • Color

  • Blend Mode

  • Orientation To Path

  • Scale

  • Cache As Bitmap Setting

  • Frame Labels

  • Motion Guides

  • Custom Easing

  • Filters

For a video tutorial about copying and pasting motion as ActionScript, see www.adobe.com/go/vid0126.

  1. Select the frames in the Timeline that contain the motion tween to copy. The frames you select must be on the same layer, however, they do not have to span a single motion tween. The selection can span a tween, empty frames, or two or more tweens.
  2. Select Edit > Timeline > Copy Motion As ActionScript 3.0.

    Provide the name of the instance to attach the motion tween to. Flash generates ActionScript specific to that instance name. Edit the Flash-generated ActionScript later for different instances.

    Flash copies to your system’s clipboard the ActionScript code that describes the selected motion tween. Paste the code into the Actions panel of a Flash document that contains the instance to receive the copied tween.

    The ActionScript code contains the following items:

    • An import of the fl.motion.Animator class

    • An XML object for the provided instance (instance_xml:XML)

    • An Animator object for the instance (instance_animator:Animator)

    • A call to the Animator.play() method to begin the animation

    Note: When working with motion guides, some differences might occur between the XML that the Copy Motion command and the Copy Motion As ActionScript 3.0 command generate. If a motion guide and custom easing is applied to a tween, the Copy Motion XML tags include the properties of the Bezier curves for the easing, and the XML uses only two keyframes. For the same tween, using the Copy Motion As ActionScript 3.0 command creates keyframes for each frame, and applies the correct values to each keyframe. If you remove the motion guide, the same XML code appears describing the custom easing for both commands.

Comments

Comments are no longer accepted for Flash CS3. Flash CS4 is the current version. To discuss Flash CS3, please use the Adobe forum.