Friday, October 16, 2009

Keylistener failing in Flex with creationComplete

Just a quick note. It appears that the stage does not get initialized in a Flex app until the applicationComplete event is fired (not creationComplete).

So if you have an init() function that sets up the listener like this:

private function init():void{
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDownHandler);
}

calling it from the application tag like this will fail:



but this will work:

No comments: