View Full Version : Making a unique tweenFunction for different buttons mouse events?

10-27-2009, 09:41 PM
Hello my name is Alfredo

And im developing a web site which needs animation for buttons in the Mouse_over and Mouse_out state.

i got my code Like this :

btn1.addEventListener(MouseEvent.MOUSE_OVER, oversection);
btn1.addEventListener(MouseEvent.MOUSE_OUT, outsection);

function outsection(evtObj:MouseEvent) {
trace ("mouse is out of "+evtObj.target.name+"")
var btnTween:Tween = new Tween(btn1_mc, "y", Strong.easeOut, -40,0,1, true);

What i want to do is change the red text which is the button to be animated for a variable which gets the name of the button in which the mouse event is taking place.
This way i dont have to do a function for each button.

Tried this but reports an error.
var btnTween:Tween = new Tween(""+evtObj.target.name+"_mc", "y", Strong.easeOut, -40,0,1, true);

Any ideas any one ?

10-28-2009, 04:17 AM
var btnTween:Tween = new Tween(evtObj.target, "y", Strong.easeOut, -40,0,1, true);

should work.