Toxiclab.org

Background picture tiration effect by action script

10.6.2008, 11:35
Submited in: Flash | Total Views: 36083

In this easy Flash lesson, I will show you how to make very attractive background titration effect using some picture and a little action script code. You can use this effect for any flash banner, header... Let's go!



Step 1

First of all Save my picture below to quickly create this tutorial!





Step 2


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



Step 3

Choose now, file > Import > Import to stage (Shortcut key: Ctrl+R) and import my picture into a flash stage.

Step 4

While the picture is still selected, go to the Align Panel (Ctrl+K) and do the following:

1. Make sure that the Align/Distribute to Stage button is turned on,
2. Click on the Align horizontal center button and
3. Click the Align vertical center button.



Step 5

After that, while the picture is still selected, press F8 key (Convert to Symbol) to convert this picture into a Movie Clip Symbol.



Step 6

While the new made Movie Clip is still selected, go to the Properties Panel (Ctrl+F3) below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip picture_mc. See the picture below.



Step 7

Take the Selection Tool (V) and click once on the first frame. After that, go to the Action Script Panel (F9) and enter this code inside the actions panel:

picture_mc.filters = [new flash.filters.GlowFilter()];
var dir:Number = 12;
picture_mc.blur = 8;
picture_mc.onEnterFrame = function() {
picture_mc.blur += dir;
if ((picture_mc.blur >= 30) || (picture_mc.blur <= 10)) {
dir *= -1;
}

var filter_array:Array = picture_mc.filters;
filter_array[0].blurX = picture_mc.blur;
filter_array[0].blurY = picture_mc.blur;
picture_mc.filters = filter_array;
};

We're done!

Enjoy!

Download example

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

Browse by category


Most popular tutorials