Be a Supporter!
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
AS : Filters Sep. 12th, 2005 @ 02:32 PM Reply

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.

Rantzien
Rantzien
  • Member since: Jan. 27, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to AS : Filters Sep. 12th, 2005 @ 02:37 PM Reply

Man, I'm getting more and more excited about buying Flash 8 for every day that passes. Unfortunately, it'll probably be a while still, with my lousy salary.


BBS Signature
liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS : Filters Sep. 12th, 2005 @ 02:46 PM Reply

FINALLY A USE FOR MY GENIUS.

Heh, link :)


Sup, bitches :)

BBS Signature
Casualty
Casualty
  • Member since: Sep. 15, 2004
  • Offline.
Forum Stats
Member
Level 35
Musician
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS : Filters Sep. 12th, 2005 @ 03:06 PM Reply

At 9/12/05 02:46 PM, -liam- wrote: FINALLY A USE FOR MY GENIUS.

Heh, link :)

pretty cool liam :) not that hard to make nontheless useful, now add animated blurs and such :)

fwe
fwe
  • Member since: Jul. 24, 2003
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS : Filters Sep. 12th, 2005 @ 03:14 PM Reply

There's no point in making it now though, since flash 8 isn't even out and most of us don't have a beta. You probably should wait until it comes out, to get referance from the official help files, in order to make sure you don't miss anything


wtfbbqhax

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS : Filters Sep. 12th, 2005 @ 03:16 PM Reply

of course there is a point of making it now:

1)A lot of people use the bitchange "hack" to produce version 8 swf files (it's legal though)
2)Those people don't get any documentation or tutorials

Rustygames
Rustygames
  • Member since: May. 7, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to AS : Filters Sep. 12th, 2005 @ 03:37 PM Reply

At 9/12/05 03:16 PM, Inglor wrote: of course there is a point of making it now:

1)A lot of people use the bitchange "hack" to produce version 8 swf files (it's legal though)
2)Those people don't get any documentation or tutorials

Yes inglor is right I am so desperate to use this I cannot wait until flash 8 comes out OMG please someone control my excitement about using the new AS in flash 8 a few weeks early


- Matt, Rustyarcade.com

Glaiel-Gamer
Glaiel-Gamer
  • Member since: Dec. 28, 2004
  • Offline.
Forum Stats
Member
Level 28
Game Developer
Response to AS : Filters Sep. 13th, 2005 @ 06:22 PM Reply

bump for flash 8!

cherries
cherries
  • Member since: Jun. 7, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to AS : Filters Sep. 13th, 2005 @ 06:25 PM Reply

does this mean this tut is now rendered ussless?
since flash 8 is out

Paranoia
Paranoia
  • Member since: Apr. 22, 2005
  • Offline.
Forum Stats
Member
Level 35
Game Developer
Response to AS : Filters Sep. 13th, 2005 @ 06:25 PM Reply

Woah I've fallen in love with Flash 8


BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS : Filters Dec. 9th, 2005 @ 02:18 PM Reply

At 9/13/05 06:25 PM, -cherries- wrote: does this mean this tut is now rendered ussless?
since flash 8 is out

no, it means it was rendered useless before :P

alexhall
alexhall
  • Member since: Jul. 25, 2004
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to AS : Filters Jan. 7th, 2006 @ 06:56 PM Reply

you could just turn it into a movie clip got to properties select filters and select what filter you want.

reelbigcheese
reelbigcheese
  • Member since: Aug. 12, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to AS : Filters Jan. 7th, 2006 @ 07:13 PM Reply

At 1/7/06 06:56 PM, papperboy wrote: you could just turn it into a movie clip got to properties select filters and select what filter you want.

they were talking about using the filter's dynamically through AS see liam's example at the top XD

alexhall
alexhall
  • Member since: Jul. 25, 2004
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to AS : Filters Jan. 8th, 2006 @ 01:09 PM Reply

At 1/7/06 07:13 PM, -reelbigcheese- wrote:
At 1/7/06 06:56 PM, papperboy wrote: you could just turn it into a movie clip got to properties select filters and select what filter you want.
they were talking about using the filter's dynamically through AS see liam's example at the top XD

ok

125Maniac
125Maniac
  • Member since: Sep. 14, 2007
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to AS : Filters Mar. 1st, 2008 @ 12:54 AM Reply

This will come in very useful when I start making some violent game or another!

Just a question:
Is there any difference between using the flash IDE filter, or does AS say, lack file size.

Yambanshee
Yambanshee
  • Member since: Oct. 5, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to AS : Filters Mar. 28th, 2009 @ 08:38 AM Reply

is there any obvious problem with this code? its on a duplicated MC

var myBlurFilter = new flash.filters.BlurFilter(random(10), random(10), low);
var myFilters:Array = this.filters;
myFilters.push(myBlurFilter);
this.filters = myFilters;

It doesint seem to be applying the filter.
also, does this method lower the file size, and/or make less lag?


AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature
Yambanshee
Yambanshee
  • Member since: Oct. 5, 2008
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to AS : Filters Mar. 28th, 2009 @ 08:40 AM Reply

At 3/28/09 08:38 AM, Yambanshee wrote: is there any obvious problem with this code? its on a duplicated MC

yes there is. the quality. my bad


AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature