在air browserInvocation中,参数未通过launchApplication方法传递

时间:2012-04-11 06:03:28

标签: actionscript-3 flex air flex4 flex3

我正在使用以下代码,桌面应用程序将通过browserInvocation打开:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
                        invoke="onInvoke(event)" title="Invocation Event Log">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import flash.events.InvokeEvent;
            import flash.desktop.NativeApplication;

            public function onInvoke(invokeEvent:InvokeEvent):void {
                var now:String = new Date().toTimeString();
                logEvent("Invoke event received: " + now);

                if (invokeEvent.currentDirectory != null){
                    logEvent("Current directory=" + invokeEvent.currentDirectory.nativePath);
                } else {
                    logEvent("--no directory information available--");
                }


                Alert.show("Arg length: "+invokeEvent.arguments);

                if (invokeEvent.arguments.length > 0){
                    logEvent("Arguments: " + invokeEvent.arguments.toString());
                } else {
                    logEvent("--no arguments--");
                }
            }

            public function logEvent(entry:String):void {
                log.text += entry + "\n";
                trace(entry);
            }
        ]]>
    </mx:Script>
    <mx:TextArea id="log" width="100%" height="100%" editable="false"
                 valueCommit="log.verticalScrollPosition=log.textHeight;"/>
</mx:WindowedApplication>

另一方面,我用于通过browserInvocation启动应用程序的代码如下:

this._air.launchApplication(this.APPID, this.PUBID, new Array("vkwave"));

问题是我的桌面应用程序没有访问launchApplication参数。请指导,我做错了什么。

0 个答案:

没有答案