开发者

Blackberry Playbook: user starts up the application by clicking a file

开发者 https://www.devze.com 2023-02-09 23:59 出处:网络
I\'m trying to do an unzip like application for the Blackberry Playbook, which means that the application mostly gets launched when the user clicks a file for which the app is registered.

I'm trying to do an unzip like application for the Blackberry Playbook, which means that the application mostly gets launched when the user clicks a file for which the app is registered.

I googled a bit around, and the closed what I found is this, but MobileApplication doesn't have invoke parameter.

<?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>
&l开发者_StackOverflowt;/s:MobileApplication>


Found it:

<?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>
0

精彩评论

暂无评论...
验证码 换一张
取 消