I’ve got a little menu that I’d obviously like to give each button a different use so that when the user clicks on the different buttons, they do different things. However, the way I have it set up right now I’m not sure how to set up each individual button. Here’s what I have:
import gs.TweenLite;
import gs.easing.*;
var tabs:Array = new Array();
var btnProps:Array = new Array();
var prop:Rectangle;
for(var i:Number = 0; i < tabs_menu.numChildren; i++)
{
var _btn:MovieClip = MovieClip(tabs_menu.getChildAt(i));
_btn.buttonMode = true;
_btn.mouseChildren = false;
_btn.id = i;
_btn.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
_btn.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
tabs.push(_btn);
var _rect:Rectangle = new Rectangle(_btn.x, _btn.y, _btn.width, _btn.height);
btnProps.push(_rect);
}
TweenLite.to(tabs_menu, 1, {x:-30});
function onOver(e:MouseEvent):void
{
// prop contains the initial x,y,width,height properties of the targeted movieclip
prop = btnProps[e.target.id];
TweenLite.to(e.target, .2, {x:prop.x-10});
}
function onOut(e:MouseEvent):void
{
TweenLite.to(e.target, .2, {x:prop.x});
}
So my question is, how do I designate specific events to the buttons contained in tabs menu?