IdleSun's Weblog

October 15, 2008

Why changes?

Filed under: Quote — idlesun @ 5:08 am

“If you all you ever do is all you’ve done, then you’ll ever get is all you ever got.”, they say in Texas.

– from ‘Hot, Flat, and Crowded’ –


October 9, 2008

Flex – When is the stage available?

Filed under: Flex — idlesun @ 6:21 pm

I wanted to capture all the key strokes and handle them once my Flex app is launched. I found that I need to add a handler to the stage and I tried with the creationComplete event of my Application. However, I couldn’t get what I want because the stage variable was STILL null. And then after a while I found that there is another event right after creationComplete. That is applicationComplete. Voila! I could access the stage and got what I wanted.

<mx:Application applicationComplete="onAppComplete()">
    private function onAppComplete():void {
      if (this.stage != null)
      stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
    private function onKeyUp(event:KeyboardEvent):void	{
      // handle key strokes

By the way, I couldn’t resolve my problem without this: Flex Instantiation Life Cycle and Event Flow. Thanks Ted!

Blog at