【问题标题】:Flex : How to start a flex/air app by dragging a file to the application Icon and got the fileFlex:如何通过将文件拖到应用程序图标并获取文件来启动 flex/air 应用程序
【发布时间】:2014-05-02 11:57:28
【问题描述】:

我正在构建一个弹性应用程序

具有上传文件到服务器的功能

客户希望通过将文件拖到图标上来打开应用程序,然后应用程序将启动并开始上传。但我找不到如何实现它

谁能帮助我?任何帮助或链接将不胜感激。

编辑:感谢 alxx

这是我的代码

private function initComponents():void {
    NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvokeEvent);
}

public function onInvokeEvent(invocation:InvokeEvent):void {
    arguments = invocation.arguments;
    currentDir = invocation.currentDirectory;
    if(arguments.length > 0)
    {
        var dfile:File = new File(arguments[0]);
        if(dfile.exists) {
        if(ArrayUtil.getItemIndex(dfile.extension,ConfigManager.AllSupportedFileExtensions) > -1)
            uploadQueue.push(dfile);
            if(!logged)
                Alert.show("Please login before upload");

        }
    }           
}

【问题讨论】:

    标签: apache-flex air icons drag


    【解决方案1】:

    尝试听应用程序的 InvokeEvent.INVOKE,如here 所述。您将获得参数数组中删除文件的完整本地路径(我自己测试过。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-07
      • 1970-01-01
      • 2010-09-17
      • 2013-11-29
      • 2010-09-19
      • 1970-01-01
      相关资源
      最近更新 更多