Flash Script – Waterfall Effect

Tweet


type = 'application/x-shockwave-flash'
data = 'http://sitepointstatic.com/flash/waterfall.swf'
width = '400'
height = '400'
bgcolor = 'black'
>

Download the sample files here.

1. Import an image of a waterfall into Flash.

2. Set this picture as your background, name it, and lock the layer.

3. Create a new layer, and name it "waterfall".

4. Next, create a small circle with a gradient fill. Convert this to a graphic object, and name it "drop".

5. Convert your "drop" graphic object to a movie clip, and name it "dropmov".

6. In the "dropmov" time line create three key frames. Insert the following action into the first key frame:

pos = _y;

7. In the second key frame, insert this action:

_y = _y+2; 
if (_y >300)
{
_y = pos;
}

8. Then, in the third key frame, insert:

gotoAndPlay (2);

9. Now, return to the main time line, and reduce the alpha of the "dropmov" movieclip to 30%. Duplicate the "dropmov" movieclip such that it covers the whole water fall.

Run the movie and you should see the above effect. Well done!

Get your free chapter of Level Up Your Web Apps with Go

Get a free chapter of Level Up Your Web Apps with Go, plus updates and exclusive offers from SitePoint.

No Reader comments