Your First Union Application

Union Examples > Chat Example 1

Ready to dive right in? Great! Let's build this simple chat application for Adobe Flash:

What you'll need:

  • Reactor, the Union client SDK for Adobe Flash. The latest release is available at www.unionplatform.com/releases/reactor/.
  • Access to a Union server. For quick tests like this one, use the public Union test server at tryunion.com, which runs on port 80.

All set? Let's start coding.

Project Setup

First, create a .fla file (Flash authoring) or ActionScript project (Flex Builder/Flash Builder).

Next, locate Reactor's main class library .swc file in the main directory of the release .zip. The .swc file is named Reactor_1.0.0.x_y.swc, where x is the build number and y is the release name. To add that .swc file to your project's library path, follow these steps:

Flash Professional

  1. Select File > Publish Settings...
  2. Select the Flash tab.
  3. Select ActionScript 3.0 > Settings...
  4. Select Library Path, then select the Browse To SWC file button.
  5. Select the Reactor .swc file, then select OK, then OK.

Flash Builder

  1. Select Project > Properties... > Flex Build Path (for Flex Projects) or ActionScript Build Path (for ActionScript projects).
  2. Select the Library Path tab.
  3. Select Add SWC...
  4. Select Browse...
  5. Select the Reactor .swc file, then select OK, then OK, then OK.

The Main Class

Now let's create the application's main class. Copy the following code to a file named UnionChat.as. (Note that Union Flash clients can be written entirely on the timeline in Flash authoring, but in this example, we create the chat purely with classes. )

package {
  import flash.display.Sprite;

  public class UnionChat extends Sprite {
    public function UnionChat () {
    }
  }
}

Pages: 1 2 3 4 5 6 7