Key listener sleep and reload an Iframe

Would it be possible to have a keylistener accomplish the following pseudo code:

doSomething();
sleep(1);
reload Iframe on page;

How this relates:
I have multiple frames on my page, one which contains the flash chatroom. It has a keylistener set up for the various direction keys, and after an arrow is pushed I need it to doSomething, sleep for 1 second while doSomething runs, then reload an iFrame on the page containing php code that queries the changes doSomething performed.