2 Replies Latest reply on May 1, 2007 5:27 AM by Social Psyence

    smooth ._y movement

    Social Psyence
      Hello all. I have a simple problem, which I'm sure can be resolved quite easily. I have a movie clip that's viewable through a mask, acting as a window for content. There are two buttons which move the movie clip up and down through the window, moving in increments of 5, but the user has to repeatedly press the button to make it keep moving, which is quite tedious.

      Is there a way I can have the action repeat continuously as the user holds the button down, creating a smooth movement of the movie clip?

      Much thanks.
        • 1. Re: smooth ._y movement
          dr_ross Level 1
          Put this code on your timeline where my_btn is the instance name of the button and target_mc is the instance name of the MovieClip to move

          my_btn.onPress = function()
          this.onEnterFrame = function()//attach a handler to trigger every frame
          target_mc._y -=5;//amount to move per frame
          //when user releases button over or outside then
          my_btn.onRelease = my_btn.onReleaseOutside = function()
          delete this.onEnterFrame;//delete the handler

          hope that helped
          • 2. Re: smooth ._y movement
            Social Psyence Level 1
            So.. I'm a bit confused... The onEnterFrame will cause the target_mc to contiuously move without additional clicking?

            Sorry, I haven't had time to test this yet.