random color 1
Step 1
Create a new flash document, press Ctrl+J key (Document Properties), and set Width to 330 and Height to 200px. Frame rate set to 16fps (Frames per Second).
Step 2
Take the Rectangle Tool (R), and draw a "cube" 25x25px. See the picture below.
Step 3
While your "cube" is still selected, press F8 key to convert it into a Movie Clip. See the picture below.
Step 4
Then, open the Properties Panel (Ctrl+F3), and under
Step 5
Select the "cube" again, open the Action Script Panel (F9), and paste this script:
onClipEvent(enterFrame){
r = Math.floor(Math.random()*255)
g = Math.floor(Math.random()*255)
b = Math.floor(Math.random()*255)
colourobj=new Color(this)
colourobj.setRGB(r<<16|g<<8|b)
}
Step 6
Cick on frame 1, open again the Action Script Panel (F9), and paste this sctipt:
for(i=1;i<=50;++i){
duplicateMovieClip("cube","movie"+i,i)
}
numobjects=1
for(i=1;i<=10;++i){
for(z=1;z<=5;++z){
this["movie"+numobjects]._x = i*30;
this["movie"+numobjects]._y = z*30;
numobjects+=1
}
}
cube._visible = false;
Test your Movie (Ctrl+Enter).
We're done!
Download source file (.fla)
Learn this tutorial and see how to create random effect in flash 8 using Action Script. type cube.
0 nhận xét:
Đăng nhận xét