OpenFin

Adobe Air Adapter

API Docs Download

The Adobe AIR API provides much of the same functionality as the JavaScript API. For example, creating, wrapping and/or controlling applications/windows. It can listen/react to changes/events via addEventListener and also send/receive messages over the InterApplicationBus.

Overview

All classes are defined under the fin.desktop package.

The DesktopConnection is a singleton class which encapsulates a websocket connection with the OpenFin Desktop and is responsible for maintaining the lifetime of that connection, dispatching event listeners, invoking callbacks, and sending messages from AIR to the desktop.

public function DesktopConnection(uuid: String, host: String, port: String, onReady: Function, onError: Function = null

To use the API you will need to initialize the DesktopConnection. Once initialized, you won’t need to keep or pass references to DesktopConnection it will be automatically fetched as an when needed using DesktopConnection.getInstance();

  • uuid would be the applications uuid that you are connecting to.

  • onReady function is called once connection is established and it’s ready for communication. At this point you can start using the rest of the API.

  • onError function which takes one string argument, and gets called if there was an error in connecting with the application with reason(String) passed to it.

The key classes that form the API are System, Application, Notification, Window and InterApplicationBus. The rest of the classes are the supporting elements for the implementation of those classes. So these classes will be a good entry point for getting familiar with the API.

Please refer to the API Documentation for further details about the functionalities provided by these classes.

To get started all you need to do is to download the openfinAirAdapter.swc and add it to your project as a library, which includes all the API classes.

For an example project please look at our Github repository.

Example

package {
    import fin.desktop.System;
    import fin.desktop.connection.DesktopConnection;
    import flash.display.Sprite;

    public class Main extends Sprite {
        var connection: DesktopConnection;
        public function Main() {
            connection = new DesktopConnection("OpenFinJSAPITestBench", "localhost","9696" , onConnectionReady, onConnectionError);
        }
        private function onConnectionReady(): void{
            trace("Connection Successful!");
            System.getInstance().getVersion(getVersionCallback, getVersionErrorCallback);
        }
        private function getVersionCallback(version: String): void{
            trace("version is: ", version);
        }
        private function getVersionErrorCallback(reason: String): void{
            trace("Could not retrieve version:", reason);
        }
        private function onConnectionError(reason: String): void{
            trace("Could not connect:", reason);
        }
    }
}

Have questions? Get in touch with us at support@openfin.co.

Adobe Air Adapter


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.