A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Actionscript 3.0 to Actionscript 2.0

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    2

    Unhappy Actionscript 3.0 to Actionscript 2.0

    I need to downgrade this piece of code to Actionscript 2.0 . I'm not an expert in Flash. Any help?

    Actionscript Code:
    function resizeHandler(e:Event):void {  
          g1_mc.x = 0;  
        g1_mc.y = 0;  
        g1_mc.height = stage.stageHeight;  
        g1_mc.width = (stage.stageWidth - 550) / 2;  
        g2_mc.width = (stage.stageWidth - 550) / 2;  
        g2_mc.x = stage.stageWidth - g2_mc.width;  
        g2_mc.y = 0;  
        g2_mc.height = stage.stageHeight;  
        bigPic.height = 800;  
        bigPic.x = 0;  
        bigPic.y = 0;  
        activator.width = 500;  
        activator.height = 200;  
        activator.x = (stage.stageWidth / 2) - (activator.width / 2);  
    }  

    stage.align = StageAlign.TOP_LEFT;  
    stage.scaleMode = StageScaleMode.NO_SCALE;  
    stage.addEventListener(Event.RESIZE, resizeHandler);  

    stage.dispatchEvent(new Event(Event.RESIZE));  

    // Set variables for numbers we need in our equations  
    var activatorWidth:int = activator.width;  
    var activatorHeight:int = activator.height;  
    var boundX:int = bigPic.x + activator.x * 2;  
    var diffX:int = bigPic.width - activatorWidth;  
    var easeSpeed:int = 7;  

    // Function that activates the movement (MOUSE_OVER activator)  
    function activate(event:Event):void {  
        var divX:Number = mouseX / activatorWidth;  
        var moveX:Number = divX * diffX;  
        bigPic.x += (boundX - moveX - bigPic.x) / easeSpeed;  
        trace("Largura do Activator ,activatorWidth,: ", activatorWidth);  
        trace("Limite ,boundX,: ", boundX);  
        trace("divX: ", divX);  
        trace("diffX :", diffX);  
        trace("moveX: ", moveX);  
        trace("bigPic.x: ", bigPic.x);  
        trace("boundX - moveX - bigPic.x ,X posição do bigPic,: ", boundX - moveX - bigPic.x);  
        trace("boundX - moveX - bigPic.x ,X posição do bigPic,: ", (boundX - moveX - bigPic.x) / easeSpeed);  
    }  
    // Listeners on the activator to Add / Remove Enter Frame Events  
    activator.addEventListener(MouseEvent.MOUSE_OVER, addEnterFrameEvent);  
    activator.addEventListener(MouseEvent.MOUSE_OUT, removeEnterFrameEvent);  
    // Add Enter Frame Event Function  
    function addEnterFrameEvent (event:MouseEvent):void {  
        addEventListener(Event.ENTER_FRAME, activate);  
    }  
    // Remove Enter Frame Event Function  
    function removeEnterFrameEvent (event:MouseEvent):void {  
        removeEventListener(Event.ENTER_FRAME, activate);  
    }

  2. #2

Tags for this Thread

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