Filter Test : GlowFilter : Graphics Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Graphics » GlowFilter »

 

Filter Test


 
package {

     import flash.display.Sprite;
     import flash.filters.*;
     
     [SWF(width=550, height=400)]
     
     public class Main extends Sprite {  
          
          public function Main() {
               var square:Square = new Square();
               square.x = 150;
               square.y = 150;
               addChild(square);


               var glow:GlowFilter = new GlowFilter(0x00FF0011010);
               square.filters = [glow,dropShadow];


               var dropShadow:DropShadowFilter = new DropShadowFilter();
               var square2:Square = new Square();
               square2.x = 300;
               square2.y = 150;
               addChild(square2);
               square2.filters = [dropShadow,glow];
               
               // Change glow to blue
               glow.color = 0x0000FF;
               square.filters = [glow,dropShadow];
               
               // Change angle of drop shadow
               var filters:Array = square2.filters;
               for each (var filter:BitmapFilter in filters) {
                    if (filter is DropShadowFilter) {
                         (filter as DropShadowFilter).angle = 270;
                    }
               }
               square2.filters = filters;
               
               // Remove drop shadow
               filters = square.filters;
               filters.pop();
               square.filters = filters;
          }
     }
}

class Square extends flash.display.Sprite {

     public function Square() {
          graphics.lineStyle(3);
          graphics.beginFill(0xFFFFFF);
          graphics.drawRect(00100100);
          graphics.endFill();
     }

}

        



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Graphics
» GlowFilter