Monday, December 31, 2012

Add shadow in flash using drop shadow filter



I will introduce two methods to add shadow in a shape in flash CS6 using "add shadow filter" directly and actionscript 3.0
 1) method 1 "add show filter"
a) open Flash CS6->New actionscript 3.0, designer mode
b) using rectangle tool to create a square shape
c) Right click square, convert to MovieClip symbol.
d) left panel, under properties->filter, at the bottom, the left icon, add filters
a menu popup, select "add  drop shadow"

2) Method 2 using ActionScript 3.0
a) open Flash CS6->New actionscript 3.0, designer mode
b) using rectangle tool to create a square shape
c) Right click square, convert to MovieClip symbol, name it as s1 and  check export to actionscript
in the left panel, name the instanace of s1 as s2
d) Press F9 to enter following ActionScript:

function init() {
    var dropShadow:DropShadowFilter = new DropShadowFilter();

    dropShadow.distance=1;
    dropShadow.angle=30;
    dropShadow.color=0x555333;
    dropShadow.alpha=1;
    dropShadow.blurX=5;
    dropShadow.blurY=5;
    dropShadow.strength=1;
    dropShadow.quality=15;
    dropShadow.inner=false;
    dropShadow.knockout=false;
    dropShadow.hideObject=false;

    s2.filters=new Array(dropShadow);
}
init();

e)export or test Movie and done
video:

No comments:

Post a Comment