I needed implements in my project, a particularity interesting, a web application (Flash) launching an Adobe AIR application. First i thought use LocalConnection Class, but could not implement without the Adobe AIR application was launch.
The job was left aside until I remembered the Adobe Media Player does just that, if you already have it installed on the computer, it just open the application.
Adobe AIR has a file called air.swf(http://airdownload.adobe.com/air/browserapi/air.swf) that contains an API to faclitate the interaction between runtime and some Adobe AIR application from a web page. To do this you must load the air.swf for the same domain of your web application, is possible:
- Checking if the runtime is installed.
- Checking from a web page if an AIR application is installed.
- Installing an AIR application from the browser.
- Launching an installed AIR application from the browser.
Let the examples, first i will create a new project type Desktop Application in Flex Builder, this applcation will be appened by browser later. I need to configure the applicationID and publisherID, without these parameters, the application will be not open.
The applicationID is configured when you create the project or later int the id tag of your file .xml.
For publisherID, we need to use a digitally signing. I will set up a profect so for the purpose of exemplification (password is 123). I will simply have access to publisherID after instaling my Adobe AIR application.
The last detail is to use the allowBrowserInvocation tag.
The xml configuration file will be as below:
And our mxml:
Now let the party will be responsible for making the call to open the application. I created a project type Web Application in Flex Builder. As explained above, this application needs to load the air.swf for the domain to the call the method launchApplication passing the parameters applicationID and publisherID.
Is has not mystery, folows the complete code.
We should have the following result:
Installing and running AIR applications from a web page:
Sobre o applicationID:
Sobre o publisherID e certificados digitais suportados pelo Adobe AIR
PortuguÃªs do Brasil