openWithDefaultApplication无法在应用程序文件夹中的文件 [英] openWithDefaultApplication fails on files in application folder

查看:413
本文介绍了openWithDefaultApplication无法在应用程序文件夹中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只收到一封错误#3000:非法路径名称如果我尝试打开它放置在空气中的应用程序文件夹中的文件。如果该文件是别处应用程序文件夹它工作的外部。

I'll ONLY recieve an "Error #3000: Illegal path name" if I try to open a file which is placed inside the app-folder of the air. If the file is somewhere else outside of the app-folder it works.

private var file:File = File.documentsDirectory; 

    public function download():void{
        var pdfFilter:FileFilter = new FileFilter("PDF Files", "*.pdf"); 
        file.browseForOpen("Open", [pdfFilter]); 
        file.addEventListener(Event.SELECT, fileSelected); 
    }

    private function fileSelected(e:Event):void 
    { 
        var destination:File = File.applicationDirectory
        destination = destination.resolvePath("test.pdf");
        /*
        //This works, also if the file to copy is placed inside the appfolder
        file.copyTo(destination, true);
        */

        /*This Throws me an Error #3000, but ONLY if the file is located in
        the App folder*/
        file.openWithDefaultApplication();

    }

当我试图得到相同的文件,并将其复制到另一个地方,它做得很好。

When i try to get the same file and copy it to another place it's doing fine.

为什么呢?一些特别的东西做的,如果我想打开的文件,这是appfolder里面? 它也不会在调试模式下运行 - 滨调试

Why that? Something special to do if i wanna open files which are inside the appfolder? It also don't work in debug mode - bin-debug.

问候,特莫

推荐答案

阅读文档几次我看到了,这是不可能的后(这是不是一个错误,这是一个功能!?!)

After reading the document a few times i saw that this is not possible (it's not a bug, it's a feature!?!)

<一个href="http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7fe4.html#WS2A7C0A31-A6A9-42d2-8772-79166A98A085">Opening使用默认系统应用文件

您无法与位于应用程序目录中的文件使用openWithDefaultApplication()方法。

You cannot use the openWithDefaultApplication() method with files located in the application directory.

所以,我这样做,而不是:

So I do this instead:

file.copyTo(tempFile);
tempFile.openWithDefaultApplication();

不是很好,但它的作品。

Not so nice, but it works.

这篇关于openWithDefaultApplication无法在应用程序文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆