Basic Flash Controller

This recipe is similar to the one titled Basic iPhone Controller, but is based on Adobe Flash instead. This means it can run on devices supporting Adobe AIR, such as desktop computers and many Android-based phones and tablets. The emphasis here is on simplicity, with only key features included. Nevertheless, this app can serve as a starting point for simple control apps.

Being based on Adobe AIR, it installs directly onto your computer or device as a regular application. It requires no additional server software. Once installed, it talks directly to your WATCHOUT display computer.

WATCHOUT Configuration

This recipe assumes that a show named “AlphaBeta” exists on your display computer. Follow these steps to prepare your display computer accordingly:

  1. Download the attached “AlphaBeta.zip” file to your production computer.
  2. Unzip the file, and open the enclosed AlphaBeta.watch file using WATCHOUT production software.
  3. Open the single display and change its Address to match the IP address of your display computer. Alternatively, change the address of the display to match that of the show, which will make it work as-is with the example application.
  4. Make sure your display computer is operational with WATCHOUT display software running.
  5. Chose “Online” on the Stage menu to transfer the show to the display computer. You can now try out the two timelines in the example by clicking the Play buttons in the Task window.
  6. Finally, choose “Online” again to take the production computer offline. This lets the Flash app control the display computer.

Testing the Flash Controller

To try out the Flash app, you can run it as follows:

  1. Download and unzip the attached file SimpleFlashController.zip.
  2. Double-click the enclosed SimpleFlashController.air file to install the app. This assumes that you have Adobe AIR installed. If not, you can get it from get.adobe.com/air/.
  3. Click the buttons to control the show. This assumes your display computer is addressed 192.168.0.49. If not, you need to change the app to match the address of your display computer (see below).

SimpleFlashController.png

Revising the Application

You will need to adapt the application to meet your own requirements. This could be as simple as changing the address of the display computer to match your system’s configuration, or it could entail adding buttons, sliders or other widgets to control the show in the way you want. To adapt it, you need Adobe Flash Professional CS5 or later. The attached file SimpleFlashController.zip includes the source project, named SimpleFlashController.fla. Open this file using Flash Professional.

The Stage contains the three buttons shown in the illustration above. To change their behavior, select the first frame of the Script layer on the timeline, then open the Actions window to edit the code. The complete script looks like this:

import com.dataton.watchout.WATCHMan; // WATCHOUT Systems Manager API

import flash.events.MouseEvent;

 

// Use WATCHMan API to talk to WATCHOUT. Connect to the primary display computer.

var wo : WATCHMan = new WATCHMan(“192.168.0.49”); // Change this address to match yours

 

// Hook up our control buttons to the cmdBtnClick function

bAlpha.addEventListener(MouseEvent.CLICK, cmdBtnClick);

bBeta.addEventListener(MouseEvent.CLICK, cmdBtnClick);

 

// When control control button is clicked, tell WATCHOUT to play that timeline

function cmdBtnClick(evt : MouseEvent) : void {

  wo.Play(evt.target.label);

}

 

// Hook up Show Load button to do so

bLoad.addEventListener(MouseEvent.CLICK, function(evt) {

  wo.ShowName = “AlphaBeta”;

});

 

One thing you may want to change is the IP address of the display computer being controlled (shown in bold above). A line near the bottom of the script loads the show by setting the ShowName property to “AlphaBeta”. Here you may want to change the name of the show to load. The function named cmdBtnClick handles the two buttons used to start timelines. Note that the name of the starting timeline is taken from the button’s label, allowing you to change the name in only one place. In addition to a label, each button has a name which is used to access it from the script (those names are bAlpha and bBeta in the example above). If you add more buttons, assign them unique names in the Flash Properties window, then use those names to program the buttons in the script.

Note how you control WATCHOUT by setting properties and calling functions on the “wo” object. This is created near the top of the script by instantiating an object of the WATCHMan class. Doing so activates the WATCHOUT Systems Manager API (Application Programming Interface), which simplifies communication with WATCHOUT from Flash or JavaScript. You can read more about the various commands, properties and classes available in this API here. This API is provided by the “WATCHMan.swc” file, which is included in “SimpleFlashController.zip”. Download the complete WATCHOUT Systems Manager SDK here.

Publishing your Revised Applicaton

After changing the application, test it from within the Flash Professional environment to make sure it works properly. This is done using the Test command on the Control menu. To use it as a real application, you first need to publish it as an AIR file, which can then be installed on any computer that has Adobe AIR runtime. Use the Publish command on the File menu to publish your revised application. As part of this publishing, you must provide a code signing certificate. Such a certificate, named “TestCert.p12” is included in the ZIP file. The password for this certificate is “test”. However, you should use your own certificate, with your own company name and a better password, to publish real applications made by you. Such a certificate can be created from within Flash Professional as part of publishing your application, or obtained from companies such as Thawte, which provide properly signed and trusted certificates.

Files attached to this recipe: