Listen for the invoke event on WindowedApplication or its nativeApplication . It has an arguments array property that contains the string arguments passed during this call.
The NativeApplication application's NativeApplication object dispatches an invoke event when the application is called.
The NativeApplication object always dispatches an invoke event when the application starts, but the event can also be dispatched at other times. For example, a running application sends an additional InvokeEvent when a user activates a file associated with the application.
You can run only one instance of a specific application. Subsequent attempts to launch the application will result in a new invoke event dispatched by the NativeApplication object of the running instance. It is the applicationβs responsibility to handle this event and take appropriate measures, such as opening a new application window to display data in a file.
The objectsInvokeEvent dispatched by a NativeApplication object ( NativeApplication.nativeApplication ). To receive calls, call the addEventListener() method of the addEventListener() object. When an event logger is logged for an invoke event, it will also receive all invoke events that occurred before registration. These earlier events are dispatched after the addEventListener() call addEventListener() , but not necessarily before the new call event that can be dispatched after registration. Therefore, you should not rely on the dispatch order.
<mx:WindowedApplication creationComplete="init()"> <mx:Script> <![CDATA[ public function init():void { NativeApplication.nativeApplication.addEventListener(InvokeEvent.Invoke, onInvoke); } public function onInvoke(e:InvokeEvent):void { var args:Array = e.arguments; trace("There are " + args.length + " arguments"); for(var i:int = 0; i < args.length; i++) { trace("Argument #" + i + " " + args[i]); } } ]]> </mx:Script> </mx:WindowedApplication>
source share