Anyone got a better code?

Hi, I pretty much want the timeline to stop until the Space Bar has been touched and obviously, continue on when it has been touched…

the code I've tryed to use is here:

if (Key.onPress(Key.SPACE)) {
gotoAndPlay(2);
} else {
stop();
}

 all I really want is if someone has a better code that acctually does the job

Thanks,
jbrereton3