OK我知道,在Adobe AIR你可以调用navigateToURL(new URLRequest(url)),它就会打开用户的默认浏览器打开网页。

另外现在在AIR 2可以启动任何应用程序。

所以我想知道如果有一种方法我可以发动的尤其的浏览器中打开一个页面?

有帮助吗?

解决方案

我原来用AIR 2可以运行玲命令的参数,所以我能够实现我想要的东西,像这样:

private function openApp():void
{
    if(NativeProcess.isSupported)
    {

        var file:File = File.userDirectory;
        file = file.resolvePath("AppData/Local/Google/Chrome/Application/chrome.exe");

        var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
        nativeProcessStartupInfo.executable = file;
        var process:NativeProcess = new NativeProcess();

        var args:Vector.<String> = new Vector.<String>();
        args.push("https://www.google.com");

        nativeProcessStartupInfo.arguments = args;

        process.start(nativeProcessStartupInfo);

    }
}

其他提示

如果您正在使用的navigateToUrl它,基本上,URL传递给操作系统,并打开处理此类请求的默认应用程序。您可以使用的navigateToUrl打开Word文档和其他文件了。

我敢肯定,AIR 2的NativeProcess功能使您可以启动应用程序,但我不相信他们允许你自省系统能发现什么浏览器存在,并且该DLL / EXE文件。

在本机进程东西良好的文章: HTTP:// www.adobe.com/devnet/air/flex/quickstart/interacting_with_native_process_02.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top