Flash Essential

AS3 Guide Drop Shadow Filter

Dec 19th 2008
No Comments
respond
trackback

In this tutorial we’ll create a drop shadow filter effect using Actionscript 3.0. We’ll use the DropShadowFilter class to create the effect and add it to the Flash Essential logo below. In the download file we have the Flash Essential logo on the stage that has been converted to a Movie-Clip and been exported for Actionscript, we’ll create an instance of the logo and add the drop shadow effect to it; lets take a look how it’s done below;

Download File

Drop Shadow Filter

Step 1 - Create The Effect

First we create a new instance of our logo that we created inside the Flash library, we’ll call it “logo”. We then create a new DropShadowFilter object called dropShadow, this will give us access to all the properties, methods and events of the DropShadowFilter class. Finally we assign the dropShadow filter to our logo making sure that all the effects are added to the logo.

var logo:FlashEssential = new FlashEssential();
var dropShadow:DropShadowFilter = new DropShadowFilter();
logo.filters = [dropShadow];

dropShadow.distance = 1;
dropShadow.alpha = .2;
dropShadow.blurX = 10;
dropShadow.blurY = 10;
addChild(logo);

Step 2 - Add Some Properties

Next we’ll add the properties that’ll make up the effect; we’ll use distance, alpha, blurX and blurY properties to make up the effect. The distance measures the offset distance of shadow in pixels; the alpha scale is self-explanatory and the blurX and blurY properties add the amount of horizontal and vertical blur you want on the drop shadow. Finally we use the addChild() method to add the logo to the display list.

var logo:FlashEssential = new FlashEssential();
var dropShadow:DropShadowFilter = new DropShadowFilter();
logo.filters = [dropShadow];

dropShadow.distance = 1;
dropShadow.alpha = .2;
dropShadow.blurX = 10;
dropShadow.blurY = 10;
addChild(logo);


This post is tagged , ,



Sponsors

Explore Recent





Monthly Archives



Friends and Affiliates



No Comments

Leave a Reply