PDA

View Full Version : on(keyPress)


muppet
11-09-2005, 11:53 AM
I want to stop the main timeline at a certain point, then the user presses <space> when they want to continue.

I use stop(); and it works fine (as it should).

When I make the action look like this;

stop();
on(keyPress "<Space>"){
play();
}
the resulting SWF or EXE file just plays through as though no stop action was there. Why would this be?

Ruben
11-09-2005, 12:58 PM
and what happens when you use this code instead?someListener = new Object();
someListener.onKeyDown = function (){
if (Key.isDown(Key.SPACE)){
play();
Key.removeListener(someListener);
}
}
Key.addListener(someListener);

:) - Ruben

muppet
11-11-2005, 10:06 AM
Instead of this, I put a button with only a 'hit' state on it, then assigned an action to it. Ny mistake was trying the above code in the frame.

I used;

on(keyPress "<space>") {
play();
}

amervb
11-20-2005, 11:30 PM
U put a stop action out side of the (on) event U should put it inside (on)event to make the code works , the events stop and play in the same action that will not work, just put the stop on the frame that U want it to stop
or use gotoAndStop();.