I am using parameters from the command line which come in through the invoke handler of my WindowedApplication. I used to build using the excellent Flash Develop, we are now using Flash开发者_运维问答 Builder 4.
I would like to know where do I enter these parameters in Flash Builder 4 so I can test them while debugging my app.
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);
function onInvoke(e:InvokeEvent):void
{
trace('onInvoke', e.arguments);
}
Answering this question for Spark Application container. The WindowedApplication class allows you to do:
<s:WindowedApplication
invoke="onInvoke()"
>
but the Application container does not, so instead, you need to do this:
<s:Application
...
preinitialize="onPreinitialize()"
>
<fx:Script>
<![CDATA[
private function onPreinitialize():void
{
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);
}
private function onInvoke(e:InvokeEvent):void
{
// e.arguments is an array containing the command line args
}
]]>
</fx:Script>
精彩评论