Pausing Animation by on keyPress function

Hi, i try to make pausing in animation using on (keyPress “<Space>”) function, a have read tutorial Pausing Animation http://www.kirupa.com/developer/mx2004/pause.htm ,in this tutorial is used butons but i need with on (keyPress “<Space>”)

I try

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

not work, please help