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)

Romantic photo vibration

27.2.2009, 16:12    Total views: 9405

This, step by step action script lesson, will show you how to create photo vibration animation using a little action script code and romantic photo. You can use this lesson for some flash banner, animation... Using this lesson, you will also learn how to convert any photo into a Movie Clip Symbol, how to apply action script code on it, how to create instance name and much more!

Example:

 

Step 1

First, save the romantic photo below, which we will use for this lesson!





Step 2


Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the width of your document to 400 pixels and the height to 300 pixels. Select white as background color. Set your Flash movie's frame rate to 26 and click ok.

Step 3

Choose now File > Import > Import to stage (Ctrl+R) and import the photo that you just saved in step 1!

Step 4

While the photo is still selected, press F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.



Step 5

While the new made movie clip is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip photo. See the picture below!



Step 6

Call the current layer photo. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 7

Select the Selection Tool (V) and click once on the photo to select it. After that, go to the Action Script Panel (F9) and enter this code inside the action panel:

onClipEvent (load) {
 
 height = 400;
 width = 300;
 
 this._x = Math.round(Math.random()*width);
 this._y = Math.round(Math.random()*height);
 var temp = this._alpha=Math.random()*100;
 this._xscale = this._yscale=temp;
 cx = this._x;
 cy = this._y;
}

onClipEvent (enterFrame) {
 this._x = cx+(1+Math.random()*8);
 this._y = cy+(Math.random()*8);
}

Step 8

Click now on the first frame of layer photo and go again to the Action Script Panel (F9). Then, enter this code inside the action panel:

for (var i = 0; i<25; i++) {
 photo.duplicateMovieClip(i, i);
}

We're done now!

Test your Movie (Ctrl+Enter)!

Have a nice day!

Download source file

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: 221534

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