Toxiclab.org

Complication

15.5.2006, 11:1
Submited in: Flash | Total Views: 47430

This tutorial will show you how to create Complication effect using the Action Script. You will also learn how to draw a circle which we will use for this tutorial, how to convert it into a Movie Clip Symbol, how to use instance name and more.

Example:



Step 1





Step 2


Draw some "circle" on the stage. After that, Hit F8 (or select Modify > Convert to Symbol) to convert that  "circle" into a movie clip symbol.






Step 3

While the "circle" is still selected, open the Properties Panel (Ctrl+F3), and for <Instance name> type circle. See the picture below.



Step 4

Create a new layer above layer1 and name it ActionScript.



Step 5

Click on the first frame of ActionScript layer, open the Action Script Pannel (F9) and enter the following ActionScript code inside the Actions panel: 
for (var i = 0; i<100; i++) {
duplicateMovieClip ("circle1", "circle"+i, i);
this["circle"+i]._x = int(Math.random()*350);
this["circle"+i]._y = int(Math.random()*350);
}


Step 6

Click on the second frame of ActionScript layer , press F6 key and enter the following ActionScript code inside the Actions panel: 

for (var i = 0; i<110; i++) {
Cr = this["circle"+i];
Cr.sizX += int(Math.random()*12)-5;
Cr.sizY += int(Math.random()*12)-5;
Cr._x += Cr.sizX;
Cr._y += Cr.sizY;
if (Cr._x >= 350) {
Cr._x = 350;
Cr.sizX = -(Cr.sizX);
} else if (Cr._x <= 0) {
Cr._x = 0;
Cr.sizX = -(Cr.sizX);
}

if (Cr._y >= 350) {
Cr._y = 350;
Cr.sizY = -(Cr.sizY);
} else if (Cr._y <= 0) {
Cr._y = 0;
Cr.sizY = -(Cr.sizY);
}
}

Step 7

Click on frame 3 of ActionScript layer , press F6, and paste this script:
gotoAndPlay (1);


Step 8

Click on frame 3 of layer1 and press F5.



We're done!

Have a nice day!

Download example (22,5 KB)

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category


Most popular tutorials