5 Replies Latest reply on Apr 20, 2007 4:02 AM by Newsgroup_User

    mouseOver

    newmfa Level 1
      Hello,
      in director project, there are 2 buttons, "button A, button B"
      i tried make next event:

      if mouseEnter button A, play sound A,
      if mouseEnter button B, play sound B,

      I can't know how define mouse X,Y with buttons X,Y..!

      I tried this code:

      on exitFrame
      if sprite("button a").hitTest(_mouse.mouseLoc) = #button then
      sound(1).play(member("sound a"))
      end

      I think this wrong way..!
      sure I need some help..

      regards 4 all
      newmfa





        • 1. Re: mouseOver
          Doc Raman Level 1
          Remember that the hitTest is only for Flash sprites.

          A better way to do this would be to have a behavior attached to the two sprites. Since you are interested in a mouseEnter for the sound the behavior could simply be the following. When applying the behavior you will select which sound you want associated with that sprite.

          property pMySoundMem
          on mouseEnter me
          sound(1).play(pMySoundMem)
          end
          on getPropertyDescriptionList me
          p = [:]
          p[#pMySoundMem] = [#format:#sound,#default:"",#comment:"Sound to play:"]
          return p
          end

          • 2. Re: mouseOver
            newmfa Level 1

            before anything, "THANK YOU", really genious code.
            I tried use same way to make next events:

            "when mouseEnter button a, lingo write letter A on text box "text4input"
            "when mouseEnter button b, lingo write letter B on text box "text4input"

            look this code:

            property pMyTextMem
            on mouseEnter me
            member("text4input").text = (pMyTextMem)
            end
            on getPropertyDescriptionList me
            p = [:]
            p[#pMySoundMem] = [#format:#text,#default:"",#comment:"Input Text:"]
            return p
            end

            but i got error on line 3.. can tell me my wrong..!

            regards
            newmfa
            • 3. Re: mouseOver
              Level 7
              You need to make sure that the property (pMyTextMem) is listed in the
              getPropertDescriptionList. Also, when you set the text of the member,
              you do not want parenthesis around the property. Try this:


              property pMyTextMem

              on mouseEnter me
              member("text4input").text = pMyTextMem
              end

              on getPropertyDescriptionList me
              p = [:]
              p[#pMyTextMem]=[#comment:"Input Text:",#format:#string, #default: "" ]
              return p
              end getPropertyDescriptionList
              • 4. Re: mouseOver
                newmfa Level 1

                I try new code, but it didn't type any letters in text box,
                what is the wrong here..?

                newmfa

                • 5. Re: mouseOver
                  Level 7
                  I don't know what's wrong. It works for me. Did you add some text into
                  the GPDL to use? The default is "" which is no text. You need to add some.

                  Also make sure that your "text4input" member is on stage.