6 Replies Latest reply on Apr 27, 2006 8:10 AM by PepperKev

    Button Solution?

      I'm seem having difficulty making a button.
      I have 3 images:
      Image(1) is matte ink (1 bit, black)
      Image(2) is mouseleave button image
      Image(3) is mouseover image. Hope you get this

      I set the image(1) to use button control, the mouse over to matte button for area to click on but the matte is black therefore i use image(2) over the top of the image(1), then i set the behaviour in image(1) to change member from image(2) to Image(3) when mouse over the button

      then i set the mouseleave from image(3) to image(2) to turn back the button image to normal. Then suddenly I can't seem to use the button after i left the button, it seem to turn it off by itself. Is there seem any solution?

      Looking forward to hear from you.

        • 1. Re: Button Solution?
          Could you copy and paste your Lingo script here? Could be just a syntax error but can't tell unless I see your script

          • 2. Re: Button Solution?
            Level 7
            Yea a bit more script info would help identify the solution. One note,
            its' quite unusual to use a separate mate graphic, if one assigns matte
            ink to a sprite than any exterior white space in an irregular shapw
            becomes unclickable.
            • 3. Re: Button Solution?
              Goyza Level 1
              okay. I put two same shape of images one as matte and another as image for the button(under the matte) in the same place so i can use image to cover the button which are black for matte as i want button in unique shape not in rectangle shape.

              This Behaviour is set in image(1) (see my first post in this topic for reference)

              on mouseenter
              set the member of sprite "image(2)" to "image(3)"
              cursor 280

              on mouseleave
              cursor -1
              set the member of Sprite "image(1)" to "image(2)"

              I think I understand to problem... when the mouse leave the button, image(1) will be destoryed along with this behaviour therefore how can i reset the image(1) to orginal postition (behind the image(2))
              • 4. Button Solution?
                PepperKev Level 1
                the Matte graphic is complicating things. There's an easier way.

                I don't know how much you know about Director, so please don't be offended, I'm going to explain this in the simplest possible terms. Besides, other people might read this for help too, so I'll explain this as thoroughly as possible.

                Making a rollover button with a unique (not rectangle) shape
                Try something like this:

                You need two graphics
                your static button image (mouseLeave) is called something like "uniqueShape"
                your mouse over image is called something like "uniqueShapeOver"

                Place uniqueShape wherever you want it on the stage. Do not place "uniqueShapeOver" on the stage at all. Leave it in the cast.

                Open the "Property Inspector" pane for uniqueShape (right click the sprite and choose "properties..")

                Within this pane you see a bunch of tabs: sprite, behaviour, member etc. Make sure you're on "Sprite."

                Look for the word "Ink" with a pull-down menu next to it

                Choose "Matte." (This eliminates the need for your third image)

                Attach the following script to the sprite:
                • 5. Re: Button Solution?
                  Goyza Level 1
                  I see, I thought that the matte button has to be 1 bit image.... How silly of me. Alway thinking too hard ahead of simplicity

                  Anyway I did that as what you said it seem have created another problem...

                  the button simply disappear after mouse leave the button, I tried to look around for solution like changing sprite name and button but nothing happened? is that werid? director ignoring my behaviour??
                  • 6. Button Solution?
                    PepperKev Level 1
                    Check three things:
                    1. make sure the code is attached to the sprite. If it is attached to the castmember, this is fine, but you have to attach the same code to both images, or at least, make sure the mouseLeave, mouseDown and mouseUP info is attached to the second castmember.

                    This is because, the script is activated when you roll over, changing object1 into object2; but if there is no script or the wrong script on object2, you'll have trouble like this. Sometimes it's easier to put the script on the sprite instead of the castmember.

                    2. The mouseLeave me code should change the member name back to the member name of the original sprite.
                    So, in the above example, you've set a castmember called "uniqueShape" on the stage.
                    On mouseEnter, the sprite changes to a different cast member called "uniqueShapeOver"
                    on mouseLeave, the sprite changes BACK to the orignal cast member name, in this case, "uniqueShape," and not to anything else.

                    3. Make sure there are no other cast members in any cast that have the same name as either image. It could be switching back to a totally different castmember.