6 Replies Latest reply on Mar 17, 2010 5:00 AM by Chorale0001

    how do i tell director to do nothing if...

    Chorale0001 Level 1



      I have 2 sprite that are partially on top of each other. Both of them have a Mouseenter script that make them do something ( same for both ) and also a Mouseleave to do another thing ( again for both ).


      however when i move from each other sprite to each other, they are doing their mouseleave action, while i want them to do nothing, cause i am just changing from sprite 1 to sprite 2 that sit on top of the #1.


      Here is my idea of script: ( sorry for the bumpy weird looking script)



      Property spritenum



      On mouseleave me


        if mouseenter sprite (spritenum).member = member"8" then


          Go the frame



          go  12


        end if

      end mouseleave


      However it isn't compiling. so what do i do wrong ?


      Code reformatted by James Newton

        • 1. Re: how do i tell director to do nothing if...
          Production Monkey Level 3

          I read your other post and the best advice anyone can give you is - Hire a consultant to do the programming.


          You state that you are a graphic designer. Fine. You are not a computer programmer, so hire one. I suggest the ""Jobs & Gigs" section here: http://www.directorforum.com/  There are plenty of experienced Lingo programmers looking for work.


          As far as what you are doing wrong. Well, everything. There is nothing you have presented that is close to correct.


          No one would write the following code for a Zoom effect on mouseEnter.


          on mouseEnter me

             go 12



          You would either write some lingo to create the effect or use a FilmLoop. You don't "go" anywhere on mouseEnter.


          Hire some help. You have no idea what you are doing.

          • 2. Re: how do i tell director to do nothing if...
            James Newton, ACP Level 3

            Everybody is a beginner when they first start writing code.  When I look at my first attempts at programming, I am mortified by my naivety and inaptitude.


            "Anyone who has never made a mistake has never tried anything new." - Albert Einstein
            So... your code is not compiling.  What information does Director give you to help you understand the error?  I'm guessing that you see something like this:
              Script error: variable used before assigning a value

              if mouseenter sprite?(spritenum).member = member "8" then

            This tells you that Director doesn't understand why you put "sprite" after mouseEnter.  If you look up mouseEnter in the Scripting dictionary, you will see that it is the name of an event that is sent to a behavior on a sprite.  Director expects you to use it to create an "on mouseEnter()" handler.
            What you are trying to discover is this: what is the member of the sprite that is now under the mouse?  Computers are stupid.  You have to explain everything to them slowly.

            on mouseLeave(me)

              -- Makes the playback head jump to a different frame when the

              -- mouse rolls off this sprite... unless it rolls onto a

              -- sprite which contains a member with a given name.


              -- <HARD-CODED>

              vExpectedMemberName = "8"

              vTargetFrame = 12

              -- </HARD-CODED>


              -- Work out the name of the member in the sprite that is now

              -- under the mouse

              vSpriteChannelUnderMouse = _movie.rollover()

              vSpriteUnderMouse = sprite(vSpriteChannelUnderMouse)

              vMemberUnderMouse = vSpriteUnderMouse.member

              vNameOfMemberUnderMouse = vMemberUnderMouse.name


              -- Do the names match?

              if vNameOfMemberUnderMouse <> vExpectedMemberName then

                go vTargetFrame

              end if

            end mouseLeave



            Does this approach make sense to you?

            1 person found this helpful
            • 3. Re: how do i tell director to do nothing if...
              Chorale0001 Level 1

              Hello again Openspark and Thanks btw for your time helping a rookie, it is greatly appreciated. Programming is my weakest point, and i have to raise my skill in it.


              Your approach make a lot of sense, and i'm going to see what i can do with that.


              Expect some news about this by tomorrow, and if it is working, at the very least i will come to tell you

              • 4. Re: how do i tell director to do nothing if...
                Chorale0001 Level 1

                Well Openspark. It is working perfectly. There is just one thing.


                My sprite on which i use that sprite have a total of 7 sprite that are on top of him, 7 button to be exact, and the script is working perfect for 1 button ( the one that is "8" of course). So i went to add


                vExpectedMemberName =


                x6 with the right sprite number. What is happening is that only the last one in the list is now working, all the other got the bug back...


                I don't think that duplicating the full script 7 time is the solution, and it seem i can't just add that small part of code to add the other sprite.


                Thanks for the help, while i'll wait for your answer, i'll keep looking to find the solution myself, as i always do



                • 5. Re: how do i tell director to do nothing if...
                  James Newton, ACP Level 3

                  Try these two changes:


                  1) Change...


                    vExpectedMemberName = "8"

                    ... to:
                     vListOfMemberNames = ["8", "9", "10"] -- I'm just guessing here.  You should use the actual names of the members
                  2) Change...
                    if vNameOfMemberUnderMouse <> vExpectedMemberName then
                    ... to:

                    if not vListOfMemberNames.getPos(vNameOfMemberUnderMouse) then


                  What does this do?  The first change allows you to create a list of names.  The second change allows you to check - using the .getPos() method for lists - whether the name of the member in the sprite under the mouse is in that list.


                  Warning: getPos() will return FALSE (or 0) if there is a difference in case.  Try this in the Message window:


                  put ["lowercase"].getPos("LowerCase")

                  -- 0

                  put ["LowerCase"].getPos("LowerCase")

                  -- 1

                  put ["LowerCase"].getPos("lowercase")

                  -- 0


                  Do you see how all the case of each letter has to match for .getPos() to be able to find the string in the list?


                  For more information on how to use lists, you could look >here<.

                  • 6. Re: how do i tell director to do nothing if...
                    Chorale0001 Level 1

                    Working Perfectly ! thanks !