hide side navigation
    5 most recent
    Web Services
    Library's
    Component's
    Applications
    Articles
  Flash button as Flex icon  Flex form by email  Hello Remoting with AS3  AS3 Saving data from Flash  AS3 Loading data into Flash  Fire Effect  Contact form  Dragable buttons  Hello World with openamf  Loading helper classes  Upload with Flash 8  Transitions effects  Snapshot with Flash 8  Hello World Remoting AS2  Flash AS2 Remoting Connector  Saving data from Flash  Loading data into Flash  FlashCom & Remoting login  Cell Renderer API  Editing a table using remoting components  Flash MX2004 web service classes  Browsing a catalog  amfphp Documentation  Hello World Remoting  Online Store with AMFPHP  Flash clients for Web Services  Web Service Walk Though with NuSoap  Popup windows in flash with javascript  Installing Apache/PHP  MoreOver News Feeds  Load Edit Save Text Files via CGI  Save Movie Clip Postion via PHP and MySQL
Current Page (1) Next Page >>  View Article Example >> 1 | 2 | 3

Goals

Ok, let's resume our task:

 import flash.display.BitmapData;
import flash.filters.DropShadowFilter
import flash
.filters.BlurFilter;
import flash.geom.Matrix;
import flash.filters.ColorMatrixFilter

Filters

After that, we need to build each of the filters. Help on this version is much better documented. So can see Flash Help to understand how to use each of the filters. The first one is the ColorMatrixFilter. The ColorMatrixFilter class lets you apply a 4 x 5 matrix transformation on the RGBA color and alpha values of every pixel on the input image to produce a result with a new set of RGBA color and alpha values, basically used for saturation changes, hue rotation, luminance to alpha and various other effects. This filter use a Matrix to shift each channel (RGB) plus the alpha channel. Here we just saturate the color but you can play with the matrix to get different results

 //Build color Matrix Filter<br>
  
var matrix:Array = new Array();<br>
  
matrix matrix.concat([10010]); // red<br>
  
matrix matrix.concat([01000]); // green<br>
  
matrix matrix.concat([00110]); // blue<br>
  
matrix matrix.concat([00010]); // alpha<br>
  
var filterCol:ColorMatrixFilter = new ColorMatrixFilter(matrix);  
  

The DropShadowFilter is more easy. You pass an offset, color and degree for the shadow in the constructor (see docs for each parameter). Here's our filter:

 
var shadowFilter:DropShadowFilter = new DropShadowFilter(5450x000000100202022falsefalsefalse
 

Finally the Blur Filter (blur amount in both axis and quality, see docs) and the array of filters ready to apply to some MovieClip. Note that the filters determine mathematical operations over a source, even if the source is not defined yet. This rules will be applied to any target, and we will do in a while.

 //Build BlurFilter<br>
  
var blur:BlurFilter = new BlurFilter(10102);<br>
  
//Array of filters<br>
  
myFilters = new Array(shadowFilterblurfilterCol

 

Current Page (1) Next Page >> 1 | 2 | 3