A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: AS2 to AS3

  1. #1
    flash animator guy
    Join Date
    Oct 2006
    Location
    Daly City
    Posts
    219

    AS2 to AS3

    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");
    }

  2. #2
    do your smiles love u? slicer4ever's Avatar
    Join Date
    Dec 2005
    Location
    in a random occurance
    Posts
    475
    Quote Originally Posted by belotte View Post
    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");
    }
    Last edited by slicer4ever; 11-29-2010 at 11:24 PM.

  3. #3
    flash animator guy
    Join Date
    Oct 2006
    Location
    Daly City
    Posts
    219
    Perfect. Thanks so much!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center