Ask flASh to let a grass MC swing freely with the wind to help ing!

//It's just written, and it feels ok.

//You can directly copy the code into the scene, create a new component, draw a grass, drag it into the scene, and change the instance name to Grass.

Grass. _ visible = 0;

Function randRange(min:Number, max:Number):Number {

var random num:Number = math . floor(math . random()*(max-min+ 1))+min;

Return to randomNum

}

Function randRGB(colr)

{ c = colr % 255

b =((colr-c)% 65025)/255;

a =(colr-c-b * 255)/65025;

newcolr=randRange(a,a+ 16)*65025+randRange(b,b)*255+randRange(c,c+64);

Return to newcolr

}

for(I = 0; I< 100; i++)

{ grass . duplicate movie clip(" grass "+I,I);

This ["grass"+me]. _ x = random(550);

This ["grass"+me]. _y=randRange(400,480);

This ["grass"+me]. _xscale=randRange(50, 120);

This ["grass"+me]. _yscale=randRange(50, 120);

New color (this ["grass" +i]). set RGB(rand RGB(0x84f 2 15));

This ["grass"+me]. _rotation=randRange(- 10, 10);

This ["grass"+me]. Speed = rand range (-8,8)/10;

This ["grass"+me]. onEnterFrame = function()

{If (this. _ rotation & gt 15)

{this. _ rotation = 15;

this . speed * =- 1;

}

Else if (this. _ rotation & lt- 15)

{this. _ rotation =- 15;

this . speed * =- 1;

}

This. _ rotation +=this.speed

}

}