문제

OK I know that in Adobe Air you can call navigateToURL(new URLRequest(url)) and it will open the users default web browser to open the page.

Also now in AIR 2 you can launch any application.

So I am wondering if there is a way I can launch a particular browser to open a page in?

도움이 되었습니까?

해결책

I it turns out with AIR 2 you can run command ling arguments so I was able to achieve what I wanted like so:

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);

    }
}

다른 팁

If you're using navigateToURL it, basically, passes the URL to the operating system and opens the default application for handling such requests. You can use navigateToURL to open word documents and other files too.

I was pretty sure that the NativeProcess features of AIR 2 allow you to launch applications, but I did not believe they allow you introspect the system to discover what browsers exist and where the DLL / EXE files are.

A good article on the native process stuff: http://www.adobe.com/devnet/air/flex/quickstart/interacting_with_native_process_02.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top