Tween class

Inheritance (Root class)

ActionScript Class Name mx.transitions.Tween

The Tween class lets you use ActionScript to move, resize, and fade movie clips easily on the Stage by specifying a property of the target movie clip to be tween animated over a number of frames or seconds.

NOTE

The Tween class is supported only if you are working in a document that specifies ActionScript 2.0 in its Publish Settings.

The Tween class also lets you specify a variety of easing methods. Easing refers to gradual acceleration or deceleration during an animation, which helps your animations appear more realistic. For example, the options on a drop-down list component you create might gradually increase their speed near the beginning of an animation as the options appear, but slow down before the options come to a full stop at the end of the animation as the list is extended. Flash provides many easing methods that contain equations for this acceleration and deceleration, which change the easing animation accordingly.

The Tween class also invokes event handlers so your code may respond when an animation starts, stops, or resumes or increments its tweened property value. For example, you can start a second tweened animation when the first tween invokes its Tween.onMotionStopped event handler, indicating that the first tween has stopped.

Method summary for the Tween class

The following table lists methods of the Tween class:

Method

Description

Tween.continueTo()

Instructs the tweened animation to continue from its current value to a new value.

Tween.fforward()

Forwards the tweened animation directly to the end of the animation.

Tween.nextFrame()

Forwards the tweened animation to the next frame.

Tween.prevFrame()

Directs the tweened animation to the frame previous to the current frame.

Tween.resume()

Resumes a tweened animation from its stopped point in the animation.

Tween.rewind()

Rewinds a tweened animation to the beginning of the tweened animation.

Tween.start()

Starts the tweened animation from the beginning.

Tween.stop()

Stops the tweened animation at its current position.

Tween.toString()

Returns the class name, "[Tween]".

Tween.yoyo()

Instructs the tweened animation to play in reverse from its last direction of tweened property increments.

Property summary for the Tween class

The following table lists properties of the Tween class.

Property

Description

Tween.duration

The duration of the tweened animation in frames or seconds. Read-only.

Tween.finish

The last tweened value for the end of the tweened animation. Read-only.

Tween.FPS

The number of frames per second of the tweened animation. Read-only.

Tween.position

The current value of the target movie clip's property being tweened. Read-only.

Tween.time

The current time within the duration of the animation. Read-only.

Event handler summary for the Tween class

The following table lists event handlers of the Tween class.

Event

Description

Tween.onMotionChanged

Event handler; invoked with each change in the tweened object's property that is being animated.

Tween.onMotionFinished

Event handler; invoked when the Tween object finishes its animation.

Tween.onMotionResumed

Event handler; invoked when the Tween.resume() method is called, causing the tweened animation to resume.

Tween.onMotionStarted

Event handler; invoked when the Tween.start() method is called, causing the tweened animation to start.

Tween.onMotionStopped

Event handler; invoked when the Tween.stop() method is called, causing the tweened animation to stop.