我正在尝试为Blackberry Playbook执行类似解压缩的应用程序,这意味着当用户单击应用程序注册的文件时,应用程序通常会启动。
我google了一下,关闭我发现的是这个,但MobileApplication没有调用参数。
<?xml version="1.0" encoding="utf-8"?>
<s:MobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.TestHome"
invoke="onAppInvoke(event)">
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
private function onAppInvoke(event:InvokeEvent):void {
if (event.arguments.length>0) {
// ok app call with an arguments
var fileName:String=event.arguments[0];
trace("app open with : "+fileName);
} else {
// app open normally
trace("normal launch");
}
}
]]>
</fx:Script>
</s:MobileApplication>
答案 0 :(得分:0)
找到它:
<?xml version="1.0" encoding="utf-8"?>
<s:MobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.TestHome"
applicationComplete="myAppMain()">
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
private function myAppMain():void {
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onAppInvoke);
}
private function onAppInvoke(event:InvokeEvent):void {
if (event.arguments.length>0) {
// ok app call with an arguments
var fileName:String=event.arguments[0];
trace("app open with : "+fileName);
} else {
// app open normally
trace("normal launch");
}
}
]]>
</fx:Script>
</s:MobileApplication>