1 Reply Latest reply on Oct 1, 2008 8:20 AM by James Newton, ACP

    Can't get mouseDown event to work

    antharding
      I have created some menus with rollover and click events and these work fine when previewed from Fireworks in a browser. However when I import them into Director the rollover works, but the onClick does not. When I look at the Lingo there is no reference to the onClick function. I have amended the code myself and it sort of works, though I am not sure how to get the correct member into the property.

      The code is below and the lines in bold are the one's i have added, any help with this would be appreciated.

      -- DESCRIPTION --

      on getBehaviorDescription me
      return \
      "ROLLOVER MEMBER CHANGE" & RETURN & RETURN & \
      "Change the sprite's cast member when the mouse rolls over the sprite." & RETURN & RETURN & \
      "PARAMETERS:" & RETURN & \
      "* Rollover cast member"
      end getBehaviorDescription


      on getBehaviorTooltip me
      return \
      "Use with graphic members." & RETURN & RETURN & \
      "Swaps a sprite's cast member on rollover."
      end getBehaviorTooltip



      -- HISTORY --

      -- 22 October 1998, written for the D7 Behaviors Palette by James Newton
      --
      -- Modified 7 January, 2000 by T. Higgins to include the isOKToAttach
      -- event handler along with removing some redundant error checking.
      -- 5 March 2000: Modified to match Fireworks button order
      -- and be D7 and D8 compatible for Fireworks Importer <jba>


      property spriteNum
      property mySprite
      property myStandardMember
      property myRollovermember
      property myClickMember


      on beginSprite me
      mySprite = sprite (me.spriteNum)
      myStandardMember = mySprite.member
      if myRollovermember = 0 then myRollovermember = member(mySprite.member.number+1)

      if myClickMember = 0 then myClickMember = member(mySprite.member.number+1)
      end


      on mouseEnter me
      mySprite.member = myRolloverMember
      end mouseEnter

      on mouseDown me
      mySprite.member = myClickMember
      end mouseDown




      on mouseLeave me
      mySprite.member = myStandardMember
      end mouseLeave

      on isOKToAttach (me, aSpriteType, aSpriteNum)
      case aSpriteType of
      #graphic:
      return TRUE
      #script:
      return FALSE
      end case
      end isOKToAttach

      on getPropertyDescriptionList
      if the currentSpriteNum = 0 then exit
      theMember = sprite(the currentSpriteNum).member
      theMemberNumber = theMember.number

      return \
      [ \
      #myRolloverMember: \
      [ \
      #comment: "Display which member on rollover?", \
      #format: #graphic, \
      #default: member (theMemberNumber + 1) \
      ] \
      ]
      end getPropertyDescriptionList

        • 1. Re: Can't get mouseDown event to work
          James Newton, ACP Level 3
          Your browser is responding to events generated by the HTML page. Director responds to events generated by Director. onClick is not a Director event, which is why you can find no documentation on it.

          I have never tried creating menus in Fireworks and then importing them into Director, so I don't know exactly what you are working with. If your "menus" are just a series of buttons, then you could try using the Mouse States behavior that you can find at http://nonlinear.openspark.com/tips/scripts/button/index.htm. This provides for rollover and mouseDown states, and also changes the cursor.

          You will need to add a separate behavior with an "on mouseUp" handler that will actually do something when the button is clicked.

          As far as modifying the Rollover Member Change behavior is concerned, try replacing the current getPropertyDescriptionList() handler with the following: