3 Replies Latest reply on Aug 13, 2007 7:35 PM by James Newton, ACP

    checking what cursor has specific sprite

    Level 7
      Hi

      I have some animated cursors in my applications
      they are set with command

      global handCursor, defaultCursor

      on beginSprite me
      sprite(me.spriteNum).cursor=handCursor
      end

      on endSprite me
      sprite(me.spriteNum).cursor=defaultCursor
      end

      on mouseDown me
      if random (2)=2 then
      sprite(me.spriteNum).cursor=handCursor
      else
      sprite(me.spriteNum).cursor=defaultCursor
      end if
      end

      Everything works fine

      But I can not define in runtime which cursor is set now to this sprite
      following line of code

      if sprite(me.spriteNum).cursor=handCursor then

      is always false, no difference which of 2 cursors is set now to this sprite
      Therefore the question: how can I define what of 2 cursors is active now for
      current sprite

      Any help will be appreciated


        • 1. Re: checking what cursor has specific sprite
          Level 7
          Are you setting the cursor and checking the cursor in the same behavior?
          If you have a behavior that looks like this:

          global handCursor, defaultCursor

          on beginSprite me
          sprite(me.spriteNum).cursor=handCursor
          end

          on endSprite me
          sprite(me.spriteNum).cursor=defaultCursor
          end

          on mouseDown me
          if random (2)=2 then
          sprite(me.spriteNum).cursor=handCursor
          else
          sprite(me.spriteNum).cursor=defaultCursor
          end if
          end

          If you are setting the cursor on a mouseDown event, are you changing the
          cursor on any other action?

          Where are you asking the sprite what its cursor is?

          --
          Rob

          ___________
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412.243.9119
          • 2. Re: checking what cursor has specific sprite
            Level 7
            I'm asking it from the same script or from another script
            The result is something like "[131080]"

            "Rob Dillon" <rob@-remove-ddg-designs.com> wrote in message
            news:f9pjoe$4q6$1@forums.macromedia.com...
            > Are you setting the cursor and checking the cursor in the same behavior?
            > If you have a behavior that looks like this:
            >
            > global handCursor, defaultCursor
            >
            > on beginSprite me
            > sprite(me.spriteNum).cursor=handCursor
            > end
            >
            > on endSprite me
            > sprite(me.spriteNum).cursor=defaultCursor
            > end
            >
            > on mouseDown me
            > if random (2)=2 then
            > sprite(me.spriteNum).cursor=handCursor
            > else
            > sprite(me.spriteNum).cursor=defaultCursor
            > end if
            > end
            >
            > If you are setting the cursor on a mouseDown event, are you changing the
            > cursor on any other action?
            >
            > Where are you asking the sprite what its cursor is?
            >
            > --
            > Rob
            >
            > ___________
            > Rob Dillon
            > Adobe Community Expert
            > http://www.ddg-designs.com
            > 412.243.9119


            • 3. Re: checking what cursor has specific sprite
              James Newton, ACP Level 3
              It sounds as if you are using a cursor member which lives in member 8 of castLib 2. You are doing something like this...

              sprite(1).cursor = member(8, 2)

              ... and Director is understanding this:

              sprite(1).cursor = [member(8, 2).number]

              Note that, for members in castLib 1, Director adds 65536 to the member's .number. If you place a cursor member in member(1, 1), then use...

              sprite(1).cursor = member 1

              ... Director will translate this to:

              sprite(1).cursor = [65537]

              So: you need to make sure that handCursor and defaultCursor are in the format that Director expects. The conversion process is highly convoluted. The handler below does its best to return a value that Director can usefully and safely use, but there may be cases that I haven't tested.

              I suggest that you try:

              handCursor = ConvertToCursor(<whatever value you are currently using for handCursor>)
              defaultCursor = ConvertToCursor(<whatever value you are currently using for defaultCursor>)