PDA

View Full Version : using buttons


biderman
02-03-2006, 04:11 PM
Hi. I'm looking for actionscript code equivalent to:
" do nothing until a button is pressed" while still maintain my entire code in the same frame.
Thank in advance.

Cota
02-03-2006, 09:43 PM
btn_instanceName.onRelease = function(){
//Do stuff when pressed
}
you place that with the rest of the code and you should be fine.

biderman
02-04-2006, 04:37 AM
Thanks

biderman
02-04-2006, 04:57 AM
It's me again.
This handler works fine when the button is acting but it doesn't make the script "wait and do nothing until .." . I will keep moving through the code !Moshe.

flashead
02-04-2006, 06:11 AM
what you're asking for and what cota gave you are technically the same thing.
can you post the code that you want to 'actively wait' for a button press?
cause i'm not sure what you mean.
thanks.
k.

biderman
02-04-2006, 06:39 AM
Hi. What I meant is that if it waits, how come the "doesn't wait" shows ?
X=function(){do something}
key1.onPress=X;
key2.onPress=X;
key3.onPress=X;
trace("doesn't wait");

Cota
02-04-2006, 06:53 AM
Flash will read all the code...so the trace will always be run..place it in the function and you wont have that problem.

biderman
02-04-2006, 06:59 AM
I tried with function too.. Please advise how to. Thanks

flashead
02-06-2006, 03:19 PM
what cota was saying is that your trace wasn't in your function, so the trace gets called right away.

function X()
{
trace( "this code 'waits' for an onPress");
// other code that you only wan't to call with onPress
};

key1.onPress = X;
key2.onPress = X;
key3.onPress = X;

k.