views:

350

answers:

2

How can I use command line arguments in a creationComplete event handler? It seems the invoke event happens in my AIR app after creationComplete gets called, so I can't use the args in that function, although I really would like to. Any other event that might always fire after the invoke event happens?

+1  A: 

I don't think that will be possible. I just checked the sources and the invokes are set up in an enterframe handler AFTER the creationcomplete event has fired. You could perhaps subclass WindowedApplication and try to change that order, but there will probably be a good reason why it is implemented that way.

You can find the WindowedApplication.as file in [FLEX_DIR]\sdks\3.1.0\frameworks\projects\airframework\src\mx\core

Interesting comment on line 2942:

Because of the behavior with the nativeApplication invoke event

we queue events up until windowComplete

Christophe Herreman
A: 

While Christophe is right, you can actually get your parameters before creation complete. As Christophe said, in a WindowedApplication, invokeEvents are queued during initialization and dispatched after creation complete. However, you can perfectly listen for the invoke event of the underlying NativeApplication object. You will then be notified of the invoke events as the happen, ie before creation complete.