3 Replies Latest reply on Aug 21, 2006 2:46 PM by abeall

    Tool Tip Help?

    Westside London Level 1
      Hi, Ive made a tool tip (note) that appears when the mouse passes over a button. at the moment the tooltip appears instantly when the user rolls the mouse over the button and dissapears when the mouse rolls out (this is how i want it to work) I also have the tooltip following the mouse when it moves whilst in the button. The movement is instant, i wondered if it was possible to have a short delat between the movement of the mouse and the tooltip, so it eases in slowly to the movement of the mouse?? below is the code im using, any help would be wicked. Thanks for any help Ad.

      tooltip._visible = false;

      var tipInt;

      b1.onRollOver = function() {
      tipInt = setInterval(showTip,100,"Button 1");
      }

      b1.onRollOut = function() {
      hideTip();

      }

      var count = 0;

      function showTip(tiptext) {
      if (count == 0) {
      clearInterval(tipInt);
      count = 0;
      tooltip.tiptext.text = tiptext;
      tooltip._x = _root._xmouse;
      tooltip._y = _root._ymouse;
      tooltip._visible = true;
      _root.onMouseMove = function() {
      tooltip._x = _root._xmouse;
      tooltip._y = _root._ymouse;
      updateAfterEvent();
      };
      } else {
      count++;
      }
      }

      function hideTip() {
      clearInterval(tipInt);
      tooltip._visible = false;
      delete _root.onMouseMove;
      }
        • 1. Re: Tool Tip Help?
          abeall Level 3
          You could try using the Tween class:
          http://www.kirupa.com/developer/actionscript/tween.htm

          or simply:
          function showTip(tiptext) {
          if (count == 0) {
          tooltip._alpha = 0;
          tooltip.onEnterFrame = function(){
          this._alpha += 10;
          if(this._alpha >= 100)delete this.onEnterFrame;
          }
          clearInterval(tipInt);
          ...
          • 2. Re: Tool Tip Help?
            Westside London Level 1
            Thanks but i wanted the movement of the tooltip movie clip to ease gently if the mouse is moved within the button. At the moment it follows the mouse when you rollover the button but i wanted to get a smoother movement. I have found this code which when applied to a movie clip creates the desired movement

            onClipEvent (load) {
            _x = 0;
            _y = 0;
            speed = 5;
            }
            onClipEvent (enterFrame) {
            endX = _root._xmouse;
            endY = _root._ymouse;
            _x += (endX-_x)/speed;
            _y += (endY-_y)/speed;
            }
            is there any way to add this into the code i had before to get the movement of the tooltip movieclip smoother when the mouse is moved??

            Any help would be amazing. Thanks Ad!!
            • 3. Re: Tool Tip Help?
              abeall Level 3
              Yeah, change your onMouseMove to this:
              _root.onEnterFrame = function() {
              var speed = 5;
              tooltip._x += (_root._xmouse-tooltip._x)/speed;
              tooltip._y += (_root._ymouse-tooltip._y)/speed;
              };