Flash tutorials
Home 3D (2) Actionscripting (65) Animation (100) Audio (4) Drawing (7) Full flash sites (4) Getting Started (15) Navigation (25) Special Effects (52) Text Effects (38)

Hide the object

2.11.2006, 15:17    Total views: 33435

In this tutorial, I will teach you how to hide any object in flash 8 using the Action Script.



Move your mouse over the objects, to hide it.

Step 1

Create a new flash document, choose Modify > Document (Ctrl+J), and set Width and Height to 250px. Frame rate set to 45fps (Frames per Second).



Step 2


Draw, or Import any object. For this example I will draw a "circle". See the picture below.



Step 3

Then, press F8 key (Convert to Symbol) to convert the object into a Movie Clip.



Step 4

Double click on a new made Movie Clip (object), or choose right click and Edit in Place.




Step 5

While your object is still selected, press again F8 key to convert it again into a Movie Clip.



Step 6

Then, 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 <10 and distance >-10) {
_parent._alpha = distance;
_parent._alpha = distance;
}
}
onClipEvent (mouseMove) {
updateAfterEvent();
}

Step 7

Go back on the main scene (Scene1), and duplicate your few times.

We're done!

Test your Movie (Ctrl+Enter).

Bye!

Download source file (.fla)

Have questions about this tutorial?
Visit our friendly Community Forums!
Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!

Top tutorials

1. Advanced full flash site - Part 1
Total views: 221536

2. Water effect
Total views: 166040

3. Photo slide show
Total views: 153641

4. High-tech city animation
Total views: 151459

5. Special Picture Effect
Total views: 146246

Related links