Solving ideas
The main idea is to make a lot of snowflakes by copying a snowflake film clip, of course there is a limit to it. Otherwise the CPU will not stand it. Then by setting the location coordinates of the copied snowflakes, the snow effect is achieved.
Specific steps
1, run Flash MX, set the document properties to 500*400. Draws the background of a gradient fill in layer 1.
2, create a new movie clip, named "Snowflake". Draw a simple snowflake shape in the editing area. Size is about 11*11 pixels. As shown in Figure 1.
3, go back to the main scene, drag the movie clip "Snowflake" into the scene, and name it "Snow" in the property panel.
4, select the movie clip, open the as panel, and add the following statement:
Onclipevent (enterframe) {//Every play one frame on the following as
This._x + = Math.random () * (This._xscale)/10;
This._y + = Math.random () * (This._yscale)/10;//let snowflakes in the X, Y axis of the upward movement, each move distance of 1/10 of their own size, in order to enhance the random effect, we use the math.random () to better control.
if (this._x>500) {
this._x = 0;
//When snowflakes drift out of the main scene, return to the left side of the main scene.
if (this._y>400) {
this._y = 0;
///When snowflakes drift out of the main scene, return to the top of the main scene.
}
5, create a new layer, add as in frame 1th
i = 1;
while (i<=200) {
Duplicatemovieclip ("Snow", "Snow" +i, I);
SetProperty ("Snow" +i, _x, Random (500));
SetProperty ("Snow" +i, _y, Random (400));
SetProperty ("Snow" +i, _xscale, Math.random () *60+40);
SetProperty ("Snow" +i, _yscale, eval ("Snow" +i). _xscale);
SetProperty ("Snow" +i, _alpha, eval ("Snow" +i). _xscale+random (30));
i++;
}
Copy 200 snowflake MC, and randomly placed in a position, and the size of snowflakes is also randomly generated, and the transparency of snowflakes by the size of the snow (X, Y axis ratio) to decide, the greater the transparency of the snowflakes higher, smaller snowflakes more transparent. This effect is close to the snow to see clearly, and the distant snowflakes a little fuzzy ... More lifelike ...