Sunday, March 22, 2009

AS3 How to use one function for several buttons

function btnOver(evt:Event):void{
trace(evt.target.name);
evt.target.gotoAndPlay("rollOver");
}
mClip1.addEventListener(MouseEvent.ROLL_OVER,btnOver);
mClip2.addEventListener(MouseEvent.ROLL_OVER,btnOver);
mClip3.addEventListener(MouseEvent.ROLL_OVER,btnOver);

No comments: