4 Replies Latest reply on Aug 24, 2006 6:40 AM by Marksman_Ash

    NOT mouswithin

    Marksman_Ash
      I am using mousewithin sprite to jump to a frame.

      What I need help with is the reverse, ie mouseoutside sprite

      I can't use a mouseleave because the mouse might already be outside the sprite.

      Any ideas
        • 1. Re: NOT mouswithin
          Level 7
          You can use 'the rollover' to find out which sprite the mouse is over at
          any given time. If you are checking for if the mouse is over sprite(1)
          or not, you could use some code like this:

          if not(the rollover)=1 then go "someFrame"

          This would be put into a frame script or a movie script

          You could also put it into a sprite behaviour, like this:

          on exitFrame me
          if (the rollover)=me.spriteNum then
          --do something when the mouse is over the sprite
          else
          --do something when the mouse is not over the sprite
          end if
          end

          Bear in mind that these events (exitFrame) will be happening often and
          fast, so you may want to add some code to make sure you are not doing
          these commands 30 times per second which could seriously slow down the
          performance of your project.
          • 2. Re: NOT mouswithin
            Level 7
            You can use 'the rollover' to find out which sprite the mouse is over at
            any given time. If you are checking for if the mouse is over sprite(1)
            or not, you could use some code like this:

            if not(the rollover)=1 then go "someFrame"

            This would be put into a frame script or a movie script

            You could also put it into a sprite behaviour, like this:

            on exitFrame me
            if (the rollover)=me.spriteNum then
            --do something when the mouse is over the sprite
            else
            --do something when the mouse is not over the sprite
            end if
            end

            Bear in mind that these events (exitFrame) will be happening often and
            fast, so you may want to add some code to make sure you are not doing
            these commands 30 times per second which could seriously slow down the
            performance of your project.
            • 3. Re: NOT mouswithin
              Level 7
              > You can use 'the rollover' to find out which sprite the mouse is over at
              > any given time. If you are checking for if the mouse is over sprite(1)
              > or not, you could use some code like this:

              Note that unlike mouseWithin, the rollover responds to the rect of the
              sprite, not it's actual shape. (A problem for non-rectangular sprites using
              the Matte or Mask inks.) If you have an unusual shaped sprite, it may be
              better to keep track of things using a flag variable that changes on
              mouseEnter and mouseLeave. Besides the fact that those do respond to
              Matte/Mask inks on odd-shaped sprites, they're also less memory intensive,
              in that they aren't checking every frame.


              • 4. Re: NOT mouswithin
                Marksman_Ash Level 1
                That works great thanks.