[LEFT]Morning everyone, would someone please have a look at the following code, for some reason when i apply the filter, it applies it to every clip on the stage. I just want it on the clips contained in the sweets array. Any help would be greatly appreciated??
import flash.filters.ColorMatrixFilter;
var matrix;
var colorFilter;
var n = 0;
sweets = new Array();
sweetsNum = 20;
sweetsClips = 15;
for (i = 0; i < sweetsClips; i++)
{ sweetsNum --;
var mcSweets = sweets_mc.duplicateMovieClip(“newclip_sweets”+sweetsNum,sweetsNum);
sweets.unshift(‘newclip_sweets’ + sweetsNum);
mcSweets._x = random (500);
mcSweets._y = random (500);
trace (sweets);
}
btn.onPress = function()
{
for (i = 0; i < sweets.length; i++){
filters = [ colorFilter ];
n= n + 0.01;
colorFilter = new ColorMatrixFilter( matrix );
matrix =
[ 1, 0, 0, n, 0,
0, 1, 0, 0, 0,
0,0 , 1, 0, 0,
0, 0, 0, 1, 0
];
}
}
btn_take.onPress = function()
{
for (i=0; i<sweets.length; i++){
filters = [ colorFilter ];
n= n - 0.01;
colorFilter = new ColorMatrixFilter( matrix );
matrix =
[ 1, 0, 0, n, 0,
0, 1, 0, 0, 0,
0,0 , 1, 0, 0,
0, 0, 0, 1, 0
];
}
}[/LEFT]