Change the object size
3.11.2006, 15:40
Submited in: Flash | Total Views: 43170
Use this tutorial to see how to change the object size in flash 8, using the Action Script. You will also learn how to convert some object into a movie clip symbol and how to apply action script on that object.
Step 1
Create a new flash document, press Ctrl+J key (Document Properties) and set Width to 300 and Height to 200px. Frame rate set to 60 fps (Frames per second).

Step 2
Create or Import any object. For this example, I'll draw this object:

Step 3
Select the object and press F8 key (Convert to symbol) to convert it into a Movie Clip.

Step 4
Double click on a new made Movie Clip (object), to go in its inside.
Step 5
Then, while your object is still selected, press again F8 key to convert it again into a Movie Clip.

Step 6
Select the object, open the Action Script Panel (F9), and paste this script:
onClipEvent (load) { baseX = _parent._x; baseY = _parent._y; } onClipEvent (enterFrame) { distanceX = _root._xmouse-_parent._x; distanceY = _root._ymouse-_parent._y; if (distanceX < 0) { distanceX = -distanceX; } if (distanceY < 0) { distanceY = -distanceY; } distance = Math.sqrt((distanceX*distanceX)+(distanceY*distanceY)); if (distance < 350 and distance >-150) { _parent._xscale = distance; _parent._yscale = distance; } } onClipEvent (mouseMove) { updateAfterEvent(); }
Step 7
Then, while your object is still selected, open the Properties Panel (Ctrl+F3), and under Color choose Alpha and set it to 45%.
Step 8
Go back on the main scene (Scene1) and duplicate your object few times.
We're done!
Cheers!
Download example
|