I bet this is simple as hell, but I can’t figure it out since I’m kinda new to AS3. Basically I created two movieclips. The first one, named main_menu, holds several mc buttons in a for loop . The other one, named map_mc, holds a map which has several movieclips, with the alpha property set to 0. This movieclips are named map_hlight1, map_hlight2 and so on. Using tweenMax, what I want is to both add a glow filter to the buttons thenselves and change the alpha property of the map_hlight mc’s inside map_mc without having to individually add listeners to the buttons. I accomplished the former but not the later. Here is my code
stop();
import com.greensock.TweenMax;
import com.greensock.easing.*;
//buttons rollover & out
for (var i:Number=1; i<12; i++) {
main_menu["button"+i].buttonMode=true;
main_menu["button"+i].addEventListener(MouseEvent.ROLL_OVER, overHandler);
main_menu["button"+i].addEventListener(MouseEvent.ROLL_OUT, outHandler);
function overHandler(evt:MouseEvent) {
TweenMax.to(evt.target, .75, {glowFilter:{color:0xFFFFFF, alpha:0.8, blurX:10, blurY:10, strength:1, quality:3}, ease:Back.easeOut});
TweenMax.to(this.map_mc["map_hlight"]+i, .75, {alpha:1, ease:Back.easeOut});
}
function outHandler(evt:MouseEvent) {
TweenMax.to(evt.target, .75, {glowFilter:{color:0xFFFFFF, alpha:0, blurX:0, blurY:0, strength:0, quality:1}});
TweenMax.to(this.map_mc["map_hlight"]+i, .75, {alpha:0, ease:Back.easeOut});
}
}
When I test my movie, i get the following error from tweenMax:
Property alpha not found on Number and there is no default value
So I’m guessing my code is not been applied to the instance name [“map_hlight”]+i, but to the number in the “i” variable.
Any help will be greatly appreciated
Cheers!