Example of tween class dilution in Flash as

Source: Internet
Author: User

Import and use the Tween class

Create a new document and name it easetween.fla.

Create a movie clip on the stage.
Select the movie clip instance and type BALL_MC in the Instance Name text box in the property inspector.


Select Frame 1th in the timeline and add the following code to the Actions panel:

The code is as follows Copy Code

Import Mx.transitions.Tween;
Import mx.transitions.easing.*;
New Tween (BALL_MC, "_x", Elastic.easeout, Stage.width, 0, 3, true);

This code example uses two import statements. The first statement imports only the Mx.transitions.Tween class, and the second import statement uses the wildcard (*) shortcut to import the six easing classes one at a time by using a single easing class with the line code. The second statement imports an entire class package.

Tween class Fade Instance

Create a new document and name it fadetween.fla.

Create a movie clip on the stage.

Select the movie clip instance and type BALL_MC in the Instance Name text box in the property inspector.
Select Frame 1th in the timeline and add the following code to the Actions panel:

The code is as follows Copy Code

Import Mx.transitions.Tween;
Import mx.transitions.easing.*;
New Tween (BALL_MC, "_alpha", Strong.easein, 0, 3, true);


Now, BALL_MC is not moving on the stage, but is fading from 100% to full transparency in three seconds. To make the symbol fade out faster, change the duration parameter from 3 to 1 or 2.

Select Control > Test movie to view the animation.
If you change the frame rate of a document, the animation will play more smoothly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.