Flash produces a simple music waveform animation effect

Source: Internet
Author: User

The effect is accomplished by copying the x-axis coordinates of a movie clip at different locations, and by controlling the x-axis scaling of the copied movie clips.

Specific steps

1, run Flash MX, create a new graphic element, and draw a 4*30 rectangle in the editing area.

2, create a new movie clip, drag the graphic symbol from the library and drop it into the movie clip.

3, return to the main scene and place the movie clip in frame 1th of the scene. and name the movie clip "line" in the Properties panel.

4, select Frame 1th, open as Panel, add the following as:

max = 40;
Maximum Value
SetProperty ("line", _visible, false);
Sets the visibility of line to be invisible
For (I=1 i<max; i++) {
Accumulator If I is less than the maximum value
Duplicatemovieclip ("line", "line" +i, I);
Copy the movie line, the new name is line+i, depth is I
SetProperty ("line" +i, _x, i*7+100);
Set the movie X axis after replication
SetProperty ("line" +i, _y, 220);
Set the copied movie Y axis
SetProperty ("line" +i, _alpha, 70);
Set the transparency of a copied movie
}
_root.onenterframe = function () {
Onenterframe is the event handler function, which continues to be called with the movie frame frequency
For (I=1 i<max; i++) {
For loop, when I is less than the maximum accumulator
SetProperty ("line" +i, _yscale, Random (100));
}
Sets the current copied movie y-axis scaling factor to be random
};

5, save, test.

Click here to download the source file



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.