9 Replies Latest reply on Apr 14, 2008 9:14 AM by Newsgroup_User

    rollover cursor change

    Mike Crisp
      I'm using co-ordinates to control a mouseUp command (below)

      if the mousev > 510 and the mousev<530 then
      if the mouseh>216 and the mouseh<272 then
      left

      What do i need to include from the Rollover Cursor change (library behaiour) to make the cursor became a finger when it passes over the above co-ordinates ?
        • 1. Re: rollover cursor change
          Level 7
          You can set the cursor that is used when the mouse is over a sprite like
          this:

          sprite(me.spriteNum).cursor=280

          That is the finger pointer. Check out the help file for a list of all
          of them. Anyway, set it to zero when you want it to have the standard
          default one, and 280 when you want it to be the pointer (or other
          numbers for other cursors as you like)
          • 2. Re: rollover cursor change
            Level 7
            > You can set the cursor that is used when the mouse is over a sprite like
            > this:
            >
            > sprite(me.spriteNum).cursor=280
            >
            > That is the finger pointer. Check out the help file for a list of all of
            > them. Anyway, set it to zero when you want it to have the standard
            > default one, and 280 when you want it to be the pointer (or other numbers
            > for other cursors as you like)

            Addendum:
            If you want to use your own graphics for a cursor, use cursor=200 in the
            startMovie or something, then create a sprite of your graphic (don't forget
            to move the regpoint in the Paint window to where you want your hot-point)
            and either use the Sprite Track Mouse behavior from the library
            (unneccesarily bulky) or script your own by using:

            on exitFrame me
            sprite(me.spriteNum).loc = the mouseLoc
            end

            Then you can change between different cursor graphics simply by changing the
            member of that sprite.


            • 3. Re: rollover cursor change
              Level 7
              addendum to the addendum:

              you will have better luck using prepareFrame instead of exitFrame for
              the custom cursor. If you have a complex scene, the cursor will "drag"
              behind the actual mouse location if it is in exitFrame. It will be
              placed better if you use prepareFrame.
              • 4. Re: rollover cursor change
                Level 7
                > you will have better luck using prepareFrame instead of exitFrame for the
                > custom cursor. If you have a complex scene, the cursor will "drag" behind
                > the actual mouse location if it is in exitFrame. It will be placed better
                > if you use prepareFrame.

                Right, my bad. I was thinking that or enterFrame maybe. PrepareFrame
                doesn't always work, I've found. Like, you can use it on a frame script,
                but it doesn't necessarily do what you'd expect on a behavior. As always,
                use trial and error to find the best way...


                • 5. Re: rollover cursor change
                  Mike Crisp Level 1
                  Mike, I want to avoid putting a sprite on the stage (as I have 250 separate movies requiring the same bit of coding at the same position)

                  I want the curser to change ( to Finger 280) when the user passes the cursor over a certain area of my background and revert to normal when moved outside of these co-ordinates
                  • 6. Re: rollover cursor change
                    Level 7
                    You could make a script that you add to startMovie or something that
                    creates a scripted sprite that has a blend of 0, the rect that defines
                    the area you are referring to, and that cursor changing code.

                    Or you could have a movie script that constantly checks the placement of
                    the cursor and changes it if needed. That would add some overhead to the
                    program and may sow things down if you program is complex.
                    • 7. Re: rollover cursor change
                      Mike Crisp Level 1
                      Mike - I can get it to change to a finger when passing the cursor over the right place...

                      if the mousev < 530 and the mousev> 510 then
                      if the mouseh>216 and the mouseh<272 then

                      sprite(1).cursor = 280 -- Sprite (1) is the background

                      I now just need a similar bit to say if the cursor is anywhere else OR when it leaves those co-ordinates to revert to default
                      • 8. Re: rollover cursor change
                        Mike Crisp Level 1
                        Fixed it. !!!
                        Set the sprite(1).cursor = 0
                        then add the co-ordinates bit and it all works !!

                        thanks for your help
                        • 9. Re: rollover cursor change
                          Level 7
                          If you say:

                          sprite(1).cursor=0

                          at the top of the script, then it will basically tell it to always be 0
                          (default) unless the outcome of your if...then statement tells it to use
                          280.

                          Or you could put a few ...else... statements in there.