6 Replies Latest reply on Feb 6, 2008 11:11 AM by kglad

    Buggy Menu - rollover, rollout

    graham howe
      Hi,
      I was wondering if any good individual can help me here. I've got an interface of six buttons. Each button plays its own animation on rollover, and rollout.

      BUT, when you mouse over at super fast speeds, the animations sometimes doesn't start and when you suddenly stop on a button its not activated its animation.

      Is there a a way of making sure the animations begin?

      Here is my current code:

      import mx.transitions.TweenRGB;
      import mx.transitions.easing.*;
      import mx.transitions.Tween;

      six_btn.onRollOver = function(){
      gotoAndPlay(2);
      _root.x +=2;
      _root.six.swapDepths(_root.x);
      _root.circle_mc.gotoAndPlay(125);
      _root.labels_mc.gotoAndPlay("learning");
      new TweenRGB(_root.bg_mc, "RGB", Strong.easeInOut, 0xff6908, 0x7fc41c, 0.5, true);
      }
      six_btn.onRollOut = function(){
      gotoAndPlay(7);
      _root.circle_mc.gotoAndPlay(135);
      _root.labels_mc.gotoAndPlay("learningout");
      new TweenRGB(_root.bg_mc, "RGB", Strong.easeInOut, 0x7fc41c, 0xff6908, 0.3, true);
      }

      The above code seems very buggy when exploring the stage at very fast speeds (with the mouse).
      Thanks
        • 1. Re: Buggy Menu - rollover, rollout
          kglad Adobe Community Professional & MVP
          1. changing the _x or _y of a _root timeline is a bad idea.

          2. give your tweens names and stop the rollover tween before you start the rollout tween. use different tween names for your different buttons (like this.tw, for example).

          3. use the attach code option to display code in this forum.
          • 2. Re: Buggy Menu - rollover, rollout
            graham howe Level 1
            Thanks. Hey how would I stop the started animations before rollout?
            Would this be simply to target the animated mc and have it positioned before the rollout code in the cascade?

            Thanks again
            • 3. Re: Buggy Menu - rollover, rollout
              graham howe Level 1
              Hi again,
              Altering the _x of _root elements if only done in my swap depth code. Is this bad too?
              • 4. Re: Buggy Menu - rollover, rollout
                kglad Adobe Community Professional & MVP
                use the stop() method of the tween class.

                yes, that's bad.
                • 5. Buggy Menu - rollover, rollout
                  graham howe Level 1
                  Hi kglad

                  I've looked into my code and am still wondering how to make it less buggy when the mouse moves at high speeds over my buttons.

                  i've increased the invisiable buttons so the hit areas are larger. also put all the button animations inside each mc, which are the buttons.

                  My code is simply:
                  five_btn.onRollOver = function(){
                  five_btn.gotoAndPlay(2);
                  five_btn.whatyouthink_mc.gotoAndPlay(2);
                  five_btn.heart_mc.gotoAndPlay(2);
                  circle_mc.gotoAndPlay(100);
                  labels_mc.gotoAndPlay("yourvisit");
                  }
                  five_btn.onRollOut = function(){
                  five_btn.gotoAndPlay(7);
                  five_btn.whatyouthink_mc.gotoAndPlay(11);
                  five_btn.heart_mc.gotoAndPlay(2);
                  circle_mc.gotoAndPlay(110);
                  labels_mc.gotoAndPlay("yourvisitout");
                  }

                  I'd be very grateful if you could offer me any help. I'm not using any tween class on the button animations because I needed either to rotate, fade, and position them individually. The coded tween of the class was too restrictive for my creative needs ;-)

                  P.S. I could post my .fla if that helps
                  • 6. Re: Buggy Menu - rollover, rollout
                    kglad Adobe Community Professional & MVP
                    there's a limit to how frequently flash will poll the mouse's position. if your mouse is moving rapidly enough and/or your buttons are small enough, it's always possible to rollover a button and have flash fail to detect that rollover.

                    you can increase the polling rate by increase the swf's fps.