5 Replies Latest reply on Aug 20, 2008 6:59 AM by vmansx

    Creating a text button using lingo

    vmansx
      I have created a text button so that when the user rolls over the text it changes colour this part is working fine. What i need to acheive is when the text is highlited it changes colour(which i have acheived) but also to add in a > character to show were the user is in the menu for example:

      normal button = Animated Videos
      When over = > Animated Videos

      The code using for the highlighted button is:

      property spriteNum
      property my
      property myInitialColor
      property myOverColor

      on getPropertyDescriptionList
      return [#myOverColor: [#comment: "Rollover color:", #format: #color, #default: sprite(the currentSpriteNum).color]]
      end

      on beginSprite me
      my = sprite(spriteNum)
      myInitialColor = my.color
      end

      on mouseEnter me
      my.color = myOverColor
      end

      on mouseLeave me
      my.color = myInitialColor
      end

      If you have any help regarding how to get the > character to show when rolled over would be great, im very new to director and the code i used was from a previous project so the simpler the better would be great thanks
        • 1. Re: Creating a text button using lingo
          Level 7
          This is just one of several ways. Add a new property that stores the
          text of the member. On mouseEnter append the > character. On mouseLeave
          restore the member's text value back to it's original value. Very
          similar to how it changes the color.

          property spriteNum
          property my
          property myInitialColor
          property myOverColor
          property myInitialText

          on getPropertyDescriptionList
          return [#myOverColor: [#comment: "Rollover color:", #format: #color,
          #default: sprite(the currentSpriteNum).color]]
          end

          on beginSprite me
          my = sprite(spriteNum)
          myInitialColor = my.color
          myInitialText = my.member.text
          end

          on mouseEnter me
          my.color = myOverColor
          my.member.text = my.member.text & " >"
          end

          on mouseLeave me
          my.color = myInitialColor
          my.member.text = myInitialText
          end




          vmansx wrote:
          > I have created a text button so that when the user rolls over the text it
          > changes colour this part is working fine. What i need to acheive is when the
          > text is highlited it changes colour(which i have acheived) but also to add in
          > a > character to show were the user is in the menu for example:
          >
          > normal button = Animated Videos
          > When over = > Animated Videos
          >
          > The code using for the highlighted button is:
          >
          > property spriteNum
          > property my
          > property myInitialColor
          > property myOverColor
          >
          > on getPropertyDescriptionList
          > return [#myOverColor: [#comment: "Rollover color:", #format: #color,
          > #default: sprite(the currentSpriteNum).color]]
          > end
          >
          > on beginSprite me
          > my = sprite(spriteNum)
          > myInitialColor = my.color
          > end
          >
          > on mouseEnter me
          > my.color = myOverColor
          > end
          >
          > on mouseLeave me
          > my.color = myInitialColor
          > end
          >
          > If you have any help regarding how to get the > character to show when rolled
          > over would be great, im very new to director and the code i used was from a
          > previous project so the simpler the better would be great thanks
          >
          • 2. Re: Creating a text button using lingo
            robdillon Most Valuable Participant
            Is the original member of this sprite a text member? If that's the case then just change the member's text value.
            • 3. Creating a text button using lingo
              vmansx Level 1
              Hey thanks for replying its working with the new character thats great thanks, but what im exactly trying to do is when the text is highlighted the ">" character appears at the start of the text not at the end is this possible thank you for replying so quick. eg:

              Animated videos
              > Animated videos
              • 4. Re: Creating a text button using lingo
                Level 7
                vmansx wrote:
                > Hey thanks for replying its working with the new character thats
                > great thanks, but what im exactly trying to do is when the text is
                > highlighted the ">" character appears at the start of the text not at
                > the end is this possible thank you for replying so quick.

                Just set it to prepend the ">" instead of append it:

                on mouseEnter me
                my.color = myOverColor
                thisMember.text = overText && defaultText
                end

                And also, you may want to set the text to be right-justified so that
                prepending text doesn't make it jump to the right.

                Andrew


                • 5. Re: Creating a text button using lingo
                  vmansx Level 1
                  Thats brilliant thank you soo much you are a life saver much appreciated