3 Replies Latest reply on Mar 14, 2007 10:07 AM by brad9376

    Moving movieclip

      What I'd like to do is have a movieclip slide into position when the user rolls over it and slide back when the user rolls off of it. This movieclip would house buttons that I could then click to navigate to different parts of my site.

      When using the onRollOut action and onRollOut action for this movieclip I then lose the ability to target the buttons inside of this movieclip using an onPress function. From what I've read, it has something to do with button event capturing. Does anyone have code that will allow for a work around?

      Thank you...
        • 1. Re: Moving movieclip
          Instead of placing your rollOver functions on the movieclip containing the buttons, you may want to put these functions on another movieclip inside and use it as a mouse area to trigger the animation. I'm sure there a lot of ways to do this, but here is how I would set up the clip:

          Draw a box in the first frame where you want the mouse area to be and make it into a movieClip. Set the alpha to 0 so the user can't see it. Be sure to add a stop() to this frame so the clip will wait there.

          On frame 1 or 2 start the tween for your sliding buttons. Tween them into position, and back out again. Put a stop(); action on the frame where they are in position. Add your onPress to the buttons on this keyframe. (keep buttons on their own layers)
          For example:
          frame1 or 2: keyframe buttons off screen
          frame5: keyframe buttons on screen with stop() & onPress functions
          frame 10:keyframe buttons buttons off screen

          Next, go back to the movieclip with alpha set to 0 on frame 1. Add the following actionscript to it:
          on(rollOver) {

          Now when the mouse enters the invisible movieclip in the first frame, it will jump to the next frame and play the slide in animation. If you want to try this I will post details of triggering a slide out animation also. It requires a bit more actionscript.
          • 2. Re: Moving movieclip
            brockus Level 1
            I just received some code that will do what I'm looking for...thanks for looking into this -

            var overStatus:Boolean = false;

            menuMc.onMouseMove = function() {
            if (this.hitTest(_xmouse, _ymouse, true) and !overStatus) {
            overStatus = true;
            //onRollOver Actions
            } else if(!this.hitTest(_xmouse, _ymouse, true) and overStatus){
            overStatus = false;
            //onRollOut Actions
            • 3. Re: Moving movieclip
              brad9376 Level 1
              Just so it's available, here the rest of the code related to my post:

              frame 5: (buttons in position)

              var menuTimer:Number;
              var usingButtons=false;

              function onEnterFrame() {
              if (this._currentframe==5) {
              if (menuTimer<getTimer()/1000 && usingButtons==false && menuTimer!=null) {

              function resetTimer() {
              menuTimer=getTimer()/1000+2; //gives user 2 seconds to use a button

              Add the following to all the buttons:

              on(rollOver) {

              on(rollOut, dragOut) {