2 Replies Latest reply on May 30, 2011 3:07 PM by kglad

    Actionscript 3.0 to Actionscript 2.0

    tiago.070

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

       

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

        • 1. Re: Actionscript 3.0 to Actionscript 2.0
          LukeElChul Level 1

          what does this script do if i had an idea what you whanted to do in this script i could help u

          • 2. Re: Actionscript 3.0 to Actionscript 2.0
            kglad Adobe Community Professional & MVP

            :

             

            var lo:Object-{};
            lo.onResize=function
            ():Void

                  g1_mc._x = 0
               
            g1_mc._y = 0
               
            g1_mc._height = Stage.height
               
            g1_mc._width = (Stage.width - 550) / 2
               
            g2_mc._width = (Stage.width - 550) / 2
               
            g2_mc._x = Stage.width - g2_mc._width
               
            g2_mc._y = 0
               
            g2_mc._height = Stage.height
               
            bigPic._height = 800
               
            bigPic._x = 0
               
            bigPic._y = 0
               
            activator._width = 500
               
            activator._height = 200
               
            activator._x = (Stage.width / 2) - (activator._width / 2); 


            stage.align = "TL"
            stage.scaleMode = "noScale"

             

            stage.addListener(lo);

            lo.onResize();

            // Set variables for numbers we need in our equations 
            var activatorWidth:Number= activator._width
            var
            activatorHeight:Number = activator._height
            var
            boundX:Number = bigPic._x + activator._x * 2
            var
            diffX:Number = bigPic._width - activatorWidth
            var
            easeSpeed:Number = 7

            // Function that activates the movement (MOUSE_OVER activator) 
            function activate():Void
                var
            divX:Number = _xmouse / activatorWidth
                var
            moveX:Number = divX * diffX
               
            bigPic._x += (boundX - moveX - bigPic._x) / easeSpeed


            // Listeners on the activator to Add / Remove Enter Frame Events 
            activator.onRollOver = addEnterFrameEvent
            activator.onRollOut = removeEnterFrameEvent
            // Add Enter Frame Event Function 
            function addEnterFrameEvent ():Void
               
            this.onEnterFrame = activate

            // Remove Enter Frame Event Function 
            function removeEnterFrameEvent ():Void
                delete this.onEnterFrame

            }