Question

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?

Was it helpful?

Solution

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

    }
}

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top