I have this array of MovieClips (btnArr) and array of GlowFilters (gloArr):
var btnArr:Array = new Array(aBtn, bBtn, cBtn);
var gloArr:Array = new Array();
var glow:GlowFilter = new GlowFilter(0x00aaff, 0,
12, 12,
5, 1,
false, false);
for (var i = 0; i < btnArr.length; i++) {
gloArr[btnArr[i].name] = glow;
btnArr[i].filters = [gloArr[btnArr[i].name]];
}
However, when I, later in my code, Tween one of the GlowFilters in the array, it seems to apply the Tween to all of them.
var btnTween:Tween = new Tween(gloArr[e.currentTarget.name], "alpha",
Strong.easeIn,
gloArr[e.currentTarget.name].alpha, 1, 1, true);
trace(gloArr.indexOf(btnTween.obj));
I have traces set up which seem to show that until I declare that Tween all is going as expected, but the last trace there shows -1, and when I check the values of each individual filter in the array they are all increasing and decreasing together. Any ideas?
If a understood you correctly you only want to tween the glow of one of the buttons, right?
If that's the case you need to create separate instances of the glow
object each time you assign it to btnArr[i].filters = [glow]
. In your code you use only one instance of GlowFilter and share it for all of the buttons.