Adding filters

ok so the filters class is an extension of the array class…
but why can you not push to it?

im trying to make images that already have scripted filters turn black and white so far i have tried

var BWfilter:ColorMatrixFilter = new ColorMatrixFilter([0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0,0,0,1,0]);

//these don’t work
ob.filters.concat(BWfilter);
ob.filters.push(new GlowFilter());

and i know my color matrix works because when i do

ob.filters = [BWfilter];

it turns the object black and white but it drops all of the other filter naturally…

this should be simple but why doesn’t the filters array class act like an array:q:

ok, not long after my post i found the answer (that usually happens for some reason)

i found out that filters is actaully a getter and setter so the array you would push to or concatinate is only a copy and not really the filters array and thats why you cant use concat or puch, so naturally you make a copy of the copy, push to your copy then replace the whole array with your copy, i know it seems silly…

ob.curFilters = ob.filters;
ob.curFilters.push(BWfilter);
ob.filters = ob.curFilters;

but it works :sigh:

I usually just create my effect object globally at initiation.

private var bf:BlurFilter = new BlurFilter(4, 4, 3);

<< much further fown >>

bf.blurX = 200;
btn1.filters = [bf];

<< somewhere else>>

bf.blurX = 2;
btn1.filters = [bf];