From: adam on
I made a little test movie where I placed the below two scripts, one in a movie
script, and the other in a frame script. The keyDown function in the movie
script was accessible all of the time, and the other script was only accessible
while the play head was on that frame. This is the behavior I expected.

In a larger movie (more frames, scripts, stuff?) this is not working. The
frame script successfully captures the space bar press, however the function in
the movie script doesn?t ever fire. This is not the behavior I am looking for.

Any reason why the keyDown script in a movie script wouldn?t fire?


//****JavaScript****//

//This is in a movie script.
//Creates a function that will look for keyboard presses.
function keyDown() {
trace("a key has been pressed.");
//Spacebar
if (_key.keyCode == 49) {
trace("the spacebar has been pressed.");
}
}


////////////////////////////////////////////////////////////////////////////////
/

//This is in a frame script.
function exitFrame(me) {
//Watches for the SPACEBAR to be pressed, and advances the playhead if
pressed.
if (_key.keyPressed(49)) {
//Advances the playhead
_movie.go("GoHere");
} else {
//Calls a Java function that will loop on the current frame.
fLoopFrame();
}
}