Hi all - i’m making the jump to AS3 & AS3 Tween engines - TweenMax in particular -
I’m making a nav system that has tweens for the OVER , OUT & CLICK states - and then
disabling the button once clicked…this is something i used to do in AS2 & MCTween all the time but in AS3 i’m having trouble…
I’ve created some buttons that tint between different states - all over , out
& click states tween fine , but when trying to enable & disable the buttons it seems
to run the tween for “CLICK” & then re-run the “OVER” tween - indeed it looks like the MOUSE_OVER event is getting retriggered after the CLICK event.
Any way round this?
Any help greatly appreciated ,
Big thanks
import gs.TweenMax;
import fl.motion.easing.*;
/////////////////////////////////////////////////////////////////////
var speed:Number = 1;
var motion:Function = Back.easeOut;
var colourOver:String = "0XFF9900";
var colourOut:String = "0X3399FF";
var colourRelease:String = "0XFF3366";
box1.buttonMode = true;
box2.buttonMode = true;
box3.buttonMode = true;
/////////////////////////////////////////////////////////////////////
function buttonOver(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourOver , ease:motion});
}
function buttonOut(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourOut , ease:motion});
}
/////////////////////////////////////////////////////////////////////
function button1Release(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourRelease , ease:motion});
evt.target.mouseEnabled = false;
box2.mouseEnabled = true;
box3.mouseEnabled = true;
}
function button2Release(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourRelease , ease:motion});
evt.target.mouseEnabled = false;
box1.mouseEnabled = true;
box3.mouseEnabled = true;
}
function button3Release(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourRelease , ease:motion});
evt.target.mouseEnabled = false;
box1.mouseEnabled = true;
box2.mouseEnabled = true;
}
/////////////////////////////////////////////////////////////////////
box1.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
box1.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
box1.addEventListener(MouseEvent.CLICK, button1Release);
box2.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
box2.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
box2.addEventListener(MouseEvent.CLICK, button2Release);
box3.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
box3.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
box3.addEventListener(MouseEvent.CLICK, button3Release);
/////////////////////////////////////////////////////////////////////