PDA

View Full Version : Selected Button States


PhotoChick
10-26-2009, 08:55 PM
So I am switching everything over to AS3 from AS2 (finally) and I am stuck with the selected state (when using ROLL_OVER and ROLL_OUT).

I did a search and have found a ton of examples for using the timeline and labels to tween the menu states... however I haven't been able to find anything in regards to using a tween engine.

I can currently tween the selected state by just doing:

addEventListener(MouseEvent.MOUSE_DOWN, onClick);
//with the function:
function onClick(event:MouseEvent):void {
if (event.target == btn1) {
TweenMax.to(btn1, 0.5, {tint:0x0099CC});
TweenMax.to(btn2, 0.5, {tint:0x000000});
TweenMax.to(btn3, 0.5, {tint:0x000000});

}

if (event.target == btn2) {
TweenMax.to(btn2, 0.5, {tint:0x0099CC});
TweenMax.to(btn1, 0.5, {tint:0x000000});
TweenMax.to(btn3, 0.5, {tint:0x000000});
}

if (event.target == btn3) {
TweenMax.to(btn3, 0.5, {tint:0x0099CC});
TweenMax.to(btn1, 0.5, {tint:0x000000});
TweenMax.to(btn2, 0.5, {tint:0x000000});
}
}


However that is without any ROLL_OVER or ROLL_OUT states. Every time that I add those it disables the selected button state. Is there a better way to manage button states in AS3 when using a Tweening Engine to change the tints, positions, etc?

ASWC
10-26-2009, 08:57 PM
try with MOUSE_OVER, MOUSE_OUT instead