Is there a way to launch an Adobe Air Application from the browser? I am developing an application that uses webcam, and when the user enter on my site, I need to start this adobe air application installed on the user computer. Is there a way to achieve this?
Thanks!
Yes, it's called browser invocation.
This article explains how to do it. The main point is that you need to set the allowBrowserInvocation
value to true
in the AIR application's descriptor xml and listen for invocation events.
This post gives a more concrete example, though it is a tad old.
1.Set allowBrowserInvocation
as true
in app.xml
2.Register BrowserInvokeEvent
in completion,
NativeApplication.nativeApplication.addEventListener(BrowserInvokeEvent.BROWSER_INVOKE, onBrowserInvoke);
3.Then define,
protected function onBrowserInvoke(event:BrowserInvokeEvent):void
{
argumentsText = event.arguments.toString();
}
4.Create Web Application with creation Complete,
var airSWFLoader:Loader = new Loader();
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
5.Add this in click action on your control which launches client AIR app,
var appId:String = ""; //Your client app id
var pubId:String = ""; //client air publisher
var arguments = //define
airSWF.launchApplication(appId, pubId, arguments);
This thread on the Adobe forums links to the overview of launching Air apps from the browser, and the discussion covers some common problems you might encounter.