A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [AS3] Add/Remove filters at will

Hybrid View

  1. #1
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324

    [AS3] Add/Remove filters at will

    Im not sure about the easiest way to dynamically add and remove filters on a Sprite. From the docs it indicates that you have to explicitly say what the filters are - you cant simply push a new filter to the filters property.

    If I have applied one filter to something, how do I apply another filter on top of it without explicitly knowing what the previous filter was?

  2. #2
    hippie hater Cimmerian's Avatar
    Join Date
    Oct 2006
    Location
    over there
    Posts
    599
    Every DisplayObject has a filters array, however you cant acess this array directly, i mean,
    //sq.filters.push(bf);//that will not work
    so you pass a reference to this array, change this new one and put it back
    PHP Code:
    var gf:GlowFilter = new GlowFilter(0xAAFFFF,0.53232321,falsefalse);
    var 
    bf:BlurFilter = new BlurFilter(12821);

    sq.filters = [gf];
    //sq.filters.push(bf);//that will not work
    var ar:Array = new Array();
    ar sq.filters;
    ar.push(bf);
    sq.filters ar
    sq.filters = [gf]; <-- will only work cos the array was empty before
    Last edited by Cimmerian; 07-26-2007 at 12:45 PM.

  3. #3
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324
    ...so easy...

    Thank you sir!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center