2 Replies Latest reply on Mar 23, 2010 12:49 PM by K_Necelis

    Castmember not changing on mouseover

    K_Necelis

      Hopefully this is a simple question for you. I am working in Director 7 - updating an old file. I have a menu of items that appears throughout the movie and when you mouseover the menu selection it used to change the castmember out, for some reason it isn't working any longer. The menu item castmembers are white text (History) and they should switch out to yellow text (HistEx) on mouseover. Here is the current behavior scriot:

       

      on mouseEnter me

        cursor 280

        set the member of sprite the currentSpriteNum to "HistEx"

       

      on mouseUp me

        go to "HistSt"

        set the member of sprite the currentSpriteNum to "History"

       

      on mouseWithin me

        cursor 280

        set the member of sprite the currentSpriteNum to "HistEx"

       

      on mouseLeave me

        cursor -1

        set the member of sprite the currentSpriteNum to "History"

       

      on mouseDown me

        set the member of sprite the currentSpriteNum to "HistEx"

        cursor -1

      end

       

      Thank you in advance!

        • 1. Re: Castmember not changing on mouseover
          Sean_Wilson Adobe Community Professional

          You don't seem to be closing your handler definitions with an 'end' statement. While this is implicit when the compiler hits an 'on', it's good practice to do so. I can't offer insight into why your members aren't swapping except to suggest that maybe you have 2 or more members with the same name ("HistEx").

           

          I might rewrite your code as:

          property spriteNum
          property my
          
          on beginSprite me
            my = sprite(spriteNum)
          end
          
          on mouseEnter me
            cursor 280
            my.member = member("HistEx")
          end
          
          on mouseUp me
            go to "HistSt"
            my.member = member("History")
          end
          
          --on mouseWithin me
          --  cursor 280
          --  my.member = member("HistEx")
          --end
          
          on mouseLeave me
            cursor -1
            my.member = member("History")
          end
          
          on mouseDown me
            cursor -1
            my.member = member("HistEx")
          end
          

           

          This is a behavior that is crying out for re-use via a getPropertyDescriptionList handler:

          property spriteNum
          property my
          property myMember
          -- GPDL:
          property myOverMember
          property myMarker
          
          on getPropertyDescriptionList
            csn = the currentSpriteNum
            if not csn then exit
            tMember = sprite(csn).member
            pdl = [:]
            pdl[#myOverMember] = [#comment: "Rollover member:", #format: tMember.type, #default: tMember]
            pdl[#myMarker] =     [#comment: "Marker         :", #format: #marker, #default: #next]
            return pdl
          end
          
          on beginSprite me
            my = sprite(spriteNum)
            myMember = my.member
          end
          
          on mouseEnter me
            cursor 280
            my.member = myOverMember
          end
          
          on mouseUp me
            cursor -1
            go myMarker
          end
          
          on mouseLeave me
            cursor -1
            my.member = myMember
          end
          
          • 2. Re: Castmember not changing on mouseover
            K_Necelis Level 1

            Thank you Sean I will give that a shot!