Originally Posted by
belotte
Can any one tell me how to convert this AS2 to AS3?
myMC1.onRollOver=function():void {
switcherMC(myMC1);
};
myMC2.onRollOver=function():void {
switcherMC(myMC2);
}
function switcherMC(choseMC):void {
choseMC.gotoAndPlay("in");
}
straight port:
Code:
import flash.events.MouseEvent;
myMC1.addEventListener(MouseEvent.MOUSE_OVER, OverMC1);
myMC2.addEventListener(MouseEvent.MOUSE_OVER, OverMC2);
function OverMC1(m:MouseEvent):void{
switcherMC(myMC1);
}
function OverMC2(m:MouseEvent):void{
switcherMC(myMC2);
}
function switcherMC(choseMC:MovieClip):void{
choseMC.gotoAndPlay("in");
}
optimized:
Code:
mport flash.events.MouseEvent;
myMC1.addEventListener(MouseEvent.MOUSE_OVER, OverMC);
myMC2.addEventListener(MouseEvent.MOUSE_OVER, OverMC);
function OverMC(m:MouseEvent):void{
MovieClip(m.target).gotoAndPlay("in");
}