2011-02-10 48 views
0

我正在嘗試爲Blackberry Playbook做一個類似於應用程序的解壓縮應用程序,這意味着應用程序大多在用戶單擊註冊應用程序的文件時啓動。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

發現:

<?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> 
相關問題