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
- Select File > Publish Settings...
- Select the Flash tab.
- Select ActionScript 3.0 > Settings...
- Select Library Path, then select the Browse To SWC file button.
- Select the Reactor .swc file, then select OK, then OK.
Flash Builder
- Select Project > Properties... > Flex Build Path (for Flex Projects) or ActionScript Build Path (for ActionScript projects).
- Select the Library Path tab.
- Select Add SWC...
- Select Browse...
- 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 () {
}
}
}