2 Replies Latest reply on May 18, 2009 10:13 AM by Applied CD

    Missing ROLL_OVER events

    Applied CD Level 1

      I’ve got 5 groups of 6 nav buttons. We need a ton of navigation in a very small stage size, so, to reduce screen clutter each of these nav groups is a mc with the nav buttons out of frame. On ROLL_OVER a 15 frame tween in the mc slides the buttons in, on ROLL_OUT a 15 frame tween slides the buttons out.

       

      If the user is slow and deliberate with the mouse everything works fine but it’s easy to “confuse” the event handlers. If the user moves the mouse around quickly you can arrive at a point where the mouse is hovering over the menu but the required ROLL_OVER event to show the menu was never triggered. This is much easier to see in action than to describe (note that only the star one tab (top left) is coded):

       

      http://www.appliedcd.com/compass/compassBAS.html

       

      I’m assuming an active ROLL_OUT event is preempting the waiting ROLL_OVER event. Is there a cleaner way to handle this such that ROLL_OVER events don’t get lost with hyper-active users?

       

      This new forum editor doesn't seem to have a code button, so here are the listeners in plain text:

       

      //--------------------------------------------------
      function initStarTabs():void {
      s1.buttonMode = true;
      s1.tabEnabled = false;
      s1.addEventListener(MouseEvent.ROLL_OUT,onStarSlideOut);
      s1.addEventListener(MouseEvent.ROLL_OVER,onStarSlideIn);
      }

      //--------------------------------------------------
      function initActionItems():void {
      s1.buttons.a1.addEventListener(MouseEvent.CLICK,onGoActionItem);
      s1.buttons.a2.addEventListener(MouseEvent.CLICK,onGoActionItem);
      s1.buttons.a3.addEventListener(MouseEvent.CLICK,onGoActionItem);
      s1.buttons.a4.addEventListener(MouseEvent.CLICK,onGoActionItem);
      s1.buttons.a5.addEventListener(MouseEvent.CLICK,onGoActionItem);
      s1.buttons.rc.addEventListener(MouseEvent.CLICK,onGoActionItem);
      }
      //--------------------------------------------------
      function onGoActionItem(e:MouseEvent):void {
      var myActionItem:String = e.target.name;
      var myStarNum:String = e.target.parent.parent.name;
      trace(myStarNum+myActionItem);
      }

      //--------------------------------------------------
      function onStarSlideOut(e:MouseEvent):void {
      e.target.gotoAndPlay("slideOut");
      }
      //--------------------------------------------------
      function onStarSlideIn(e:MouseEvent):void {
      e.target.gotoAndPlay("slideIn");
      }

        • 1. Re: Missing ROLL_OVER events
          Ned Murphy Adobe Community Professional & MVP

          One thing you might want to employ is a coded tween rather than a timeline tween.  This can make managing the tween animation more smooth.  For the rollout you have it tween from its current x value to the full out end value, and for the rollout, you have it tween from its current value to its full in value.  That way, if someone rolls out before it finishes the rollover, it starts from where it is rather than jumping to the full out position and sliding back.  This may cure some of the problem you're having.

           

          import fl.transitions.Tween;
          import fl.transitions.easing.*;

           

          function onStarSlideOut(e:MouseEvent):void {
             var myTweenAlpha:Tween = new Tween(e.target, "x", Regular.easeOut, e.target.x, xFullOut, 1, true);
          }

           

          function onStarSlideIn(e:MouseEvent):void {
             var myTweenAlpha:Tween = new Tween(e.target, "x", Regular.easeOut, e.target.x, xFullIn, 1, true);
          }

           

          For the time element (1 second used above), you could use a ratio of the current distance (x) position over the full distance of travel to have it be consistent for different starting x positions.

          1 person found this helpful
          • 2. Re: Missing ROLL_OVER events
            Applied CD Level 1

            Thanks Ned,

             

            I actually found the ROLL_OVER event was triggering but my stop() frame for the rollout was the same as my start frame for the roll in. This worked as long as the mc was idle on either full in or full out but not when the mc was in motion. Simply separating the full in frame from the start out cured the problem (link has been updated). I’ll still probably switch to a coded tween though since it will probably be easier to manage.