Macromedia Flash - Apply Glow effects to images with AS code

In this article we will look at how to apply Glow filter to any image using the AS code.

In this article we will look at how to apply Glow filter to any image using the AS code. You can use this effect for some flash buttons or banners . Through this lesson, you will learn how to convert any image into a Movie Clip Symbol, how to give permission to execute a code on it and many other tricks.

Step 1

Create a new flash document. Press Ctrl + J key on the keyboard ( Document Properties ) and set your Frame rate to 30 and click OK .

Picture 1 of Macromedia Flash - Apply Glow effects to images with AS code

Step 2

Now select File > Import > Import to Stage ( Ctrl + R ) and import any image into the flash stage.

Step 3

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

Picture 2 of Macromedia Flash - Apply Glow effects to images with AS code

Step 4

While the newly created movie clip is still selected, go to the Properties Panel below the stage. In the left pane, you will see the Instance name field, name this Movie Clip image as shown below:

Picture 3 of Macromedia Flash - Apply Glow effects to images with AS code

Step 5

Call the current layer image. Double-click on its default name ( Layer 1 ) to rename it. Press Enter when you have finished typing the new name.

Step 6

Create a new layer above the layer image and name it action

Step 7

Select the first frame of layer action and go to the Action Script Panel ( F9 ). Then, enter this code in the actions section:

import flash.filters. *;

var gf: GlowFilter = new GlowFilter (0x70A146, 15, 18, 14, 3, 3, true, false);
var ds: DropShadowFilter = new DropShadowFilter (2, 35, 0x70a146, 5, 5, 5, .8, 3, false, false, false);

image.filters = [gf, ds];
image.onRollOver = function () {
this.onEnterFrame = function () {
gf.blurX + = (80-gf.blurX) ​​/ 5;
gf.blurY = gf.blurX;
image.filters = [gf, ds];
};
};

image.onRollOut = function () {
this.onEnterFrame = function () {
gf.blurX + = (20-gf.blurX) ​​/ 5;
gf.blurY = gf.blurX;
image.filters = [gf, ds];
if (gf.blurX <21) {
delete this.onEnterFrame;
}
};
};

Check your movie now ( Ctrl + Enter )

Good luck!

Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile