BTA Flexing

My passion RIAs…………..Shardul Singh Bartwal

Applying Filter in actionscript 3.0 and Flash CS5

Posted by Shardul Singh Bartwal on October 12, 2010

Applying this is very simple and straight forward.I am having two things on my flash stage.

One is a slider namely ‘hs’ and another one is a movie clip with name ‘rect’.Below is the code for achieving

this.As you will made the change in slider there will be a change in the filter for movie clip.Below is the code.

Please note that I am doing the frame coding so there is stop() at initial.And as I have taken the maximum value for

my Slider hs to ‘100’ and as we know alpha can have maximum value of 1,so i am dividing it by 100.

import fl.controls.Slider;
import fl.events.SliderEvent;
import flash.filters.GlowFilter;

stop();

hs.visible = true;
hs.addEventListener(SliderEvent.CHANGE,onSliderChange);
function onSliderChange(event : SliderEvent) : void
{
var s : Slider = event.currentTarget as Slider;
var glowArray:Array = [new GlowFilter(0xff0000,s.value/100,4,4,2,1,false,false)];
rect.filters = glowArray;
}

Enjoy……….Action scripting..

Advertisements

One Response to “Applying Filter in actionscript 3.0 and Flash CS5”

  1. ADAMa said

    just what i needed for my flash project, thx:)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: