Button Scripting

I made this button, and inside of the button is a movieclip the moveclip animates/moves to a certain spot. I want to be able to let the button determine wether it has been pressed or not. So if I click the button it will gotoAndPlay a scene and continue on. If the button has not been pressed which needs to be scripted telling the button wether it has been pressed which it hasnt been pressed ir will gotoAndPlay a different scene. Sort of like a different outcome.

huh?

maybe something like this
myButton.onPress = function() {
if (pressed == true) {
trace(“pressed”);
//do one thing
} else {
pressed = true;
trace(“notpressed”);
//do another
}
};

myButton.onPress = function() {
if (this.pressed == true) {
this.pressed = false;
//do one thing
} else {
this.pressed == true
trace(“notpressed”);
//do another
}
};

i think this should work if it dosnot, try
this.movSub. instead of this. or
_root. instead of this.

cheers

myButton.onPress = function() {
if (this.pressed == true) {
this.pressed = false;
//do one thing
} else {
this.pressed == true
trace(“notpressed”);
//do another
}
};

what would I have to rename and change
would I get rid of the function then put gotoAndPlay()?
or what cause Im pretty much new to action script.

that depends .

do you wish to control the main movie ?

_root.gotoAndPlay(5);

do you wish to control a movie contained inside the button ?

this.myMovie.gotoAndPlay(5);

Yes, the main movie so what would I change to the script, to make it gotoAndPlay();

do i have to spoon feed you everything ?

Unless you use your brains you wont ever learn.

I hope i dont sound rude

myButton.onPress = function() {
if (this.pressed == true) {
this.pressed = false;
_root.gotoAndPlay(5);
} else {
this.pressed == true
trace(“notpressed”);
_root.gotoAndPlay(10);
}
};

This won`t work.
if you want to toggle between 2 different things you would have to change the second this.pressed == true to this.pressed = true.
The question you asked originally was quite difficult to understand but if you
just want "I want to be able to let the button determine wether it has been pressed or not. "use the code i posted earlier.

My mistake.

Thanks for pointing that out stringy .

normally i dont give the code like this. I like to give the direction and let the other person do the rest

Symbol=Symbol 5, Layer=Layer 1, Frame=1: Line 1: Statement must appear within on handler
myButton.onPress = function() {

put the code on the timeline,not the instance. You will have to give the button an instance name of myButton.Maybe you could make it a little clearer as to what you want; i think we are all a little confused.

http://www.stickdeath.com/escape1.htm
After you get out of the car scene to part where the green guy pops out the window.
If you shoot him(click him) it plays the animation of killing and then moves on.
If you don’t click him with in a amount of frames he’ll shoot you and die.

See for yourself

i don`t think the code I or AG gave you is any use. Have a look at this might help you a little

ok, thanks a lot.