AS: Main, go give mr D some tough luvin'
This will cover filters very basically
note, these filters only work in flash 8+
so what are filters
a very basic and effective way to give your pictures very nifty effects :)
now how do I use em?
take it easy now billy, it's not hard but it's not that easy, every movieclip has it's own filters array, that array contains all the filters applied to that movieclip, by default, none.
If you want to add a filter to a movieclip that already has filters you need to do the following :
1)Create a new filter object, using the constructor (the creating function) from the filter you need
2)Assign it to mymovieclip.filters, to a temporary array
3)Add the new filter to that array
4)Assign the value of the temp array to the .filters array
as far as I know other ways don't work if you have already assigned a filter. For movieclips with no current filters, you can add the new filter directly to the (empty) .filters array.
If you need to alter an existing filter, you must first assign the movieclip's .filters to a temp array and modify the property using the temporary array. you can do temparrayname[5].propertya=valuea; directly from that point on or reassign the filter to a filter object and do it indirectly.
If you want to delete all the filters in a movieclip all you got to do is use
movieclipname.filters=new Array();
Actual Usage
Shadows
examples copied from the flash 8 documenation
shadows are rather easy, to set up a basic one you can simply do :
var myDropFilter = new flash.filters.DropShadowFilter();
var myFilters:Array = myMC.filters;
myFilters.push(myDropFilter);
myMC.filters = myFilters;
naturally it has properties , those properties are :
distance - the distance of the shadow from the target MC
angle -the angle of the shadow
color - the color of the shadow
alpha - the alpha of the shadow, values between 0 and 1 where .5 for example is 50% alpha
blurX - amount of horizontal blur (between 0.0 to 255.0 )
blurY - amount of vertical blur (between 0.0 to 255.0 )
strength - the spread of the color
quality - the quality of the shadow
Blur filter
for example
var myBlurFilter = new flash.filters.BlurFilter(x,y,quality);
var myFilters:Array = myMC.filters;
myFilters.push(myBlurFilter);
myMC.filters = myFilters;
x stands for the _x blur
y stands for the _y blur
the quality stands for the quality of the blur
I will cover other filters like bevel and such later on :) I just wanted to make another AS: tutorial since for two pages on AS main none serious have been made. hope this tutorial helps, ask any questions
I have used the unofficial documentation, once it's publicly available, I'll add a link to it.