Question reg: button?

HI I have a question regarding button.
I made a movie where button is clicked opens a door so when door opens i want to be able to close the door with the same button.
Here is what I have right now:

on (release) {
control.gotoAndStop(2);
}
So when door opens another button…

(on (release)
{gotoAndPlay(1);
}

…loads which when is clicked suppose to close the door. Everything works fine except I would like to close and open the door with same button.
I am not sure if I explained well enough. I hope I did?

Any suggestions will greatly appreciated

Thanks

try something like this:


// create a variable to tell the button what to do
// if openDoor equals true .. open door
// if openDoor equals false .. close door
on (release) {
     if (!openDoor) {
          openDoor = true
     } else if (openDoor) {
          openDoor = false
     }
     if (openDoor) {
          doorInstanceName.gotoAndPlay ("frame when door opens")
     } else if (!openDoor) {
          doorInstanceName.gotoAndPlay ("frame when door closes")
     }
}

untested but it should work
if not … post your file and i’ll fix it for you :smirk:

good luck !!