Flex DropShadowFilter - drop shadow for image

DropShadowFilter is a useful and lovely filter. you can add a drop shadow to anything with this class simple and quickly, The example code of  adding drop shadow to an image  is the following:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" layout="vertical"
 creationComplete="transformImage()"   verticalScrollPolicy="off" horizontalScrollPolicy="off">
 <mx:Script>
  <![CDATA[ 

 [Bindable]
 [Embed(source="images/demo.jpg")]
 private var demoImage:Class;
  

private function transformImage():void
{
 var filter : DropShadowFilter = new DropShadowFilter();
 filter.blurX = 4;
 filter.blurY = 4;
 filter.quality = 2;
 filter.alpha = 0.5;
 filter.angle = 45;
 filter.color = 0x202020;
 filter.distance = 6;
 filter.inner = false;
 modifiedImage.filters = [ filter ];           
    
 }
  
  
  ]]>
 </mx:Script>
 
 <mx:HBox width="900" height="400">
  <mx:VBox>
    <mx:Label text="Original Image"/>
    <mx:Image source="{demoImage}" width="400" height="300"/>
  </mx:VBox>
  <mx:VBox>
   <mx:Label text="Modified Image"/>
   <mx:Image id="modifiedImage" source="{demoImage}" width="400" height="300"/>
  </mx:VBox>
 </mx:HBox>
 
</mx:Application>


 




Comment: 0 | Read times: -
Announce commentary
Your name
Content
Validation code Code