Accessibility

Table of Contents

Creating your first desktop instant messenger using Adobe AIR, Flash Media Server, and WebORB.NET

Analyzing the functionality

Whenever you begin any development project, it is necessary to do some preplanning before you can actually build your application. To get started, you'll need to have a clear understanding of how the data will flow and the application will be triggered (see Figure 1).

Data flow of an application with WebORB integration

Figure 1. Data flow of an application with WebORB integration

The two main triggers for this sample application include a trigger that occurs when a user wishes to chat with another user, and a trigger that occurs when a user enters or leaves the chat application. Additionally, there is an initial trigger that is invoked upon connection that basically just pushes data back up to the client. In an instant messaging (IM) application such as this, that data includes the user's buddy list.

It is also critical in the planning stage to map out how the data will flow from Client A to Client B through WebORB and Flash Media Server (see Figure 2).

Identifying how data flows between clients in the preplanning stage of development

Figure 2. Identifying how data flows between clients in the preplanning stage of development

Let's talk through the functionality of the application. In a real-world example, User A connects to the system and their buddy list is retrieved from the database or service. (Note that this part of the project is outside the scope of this article.) User A's buddy list is then used to push data to all buddies that are currently online in order to update their buddy lists with User A's online status. Then User A's buddy list is sent to User A via a NetConnection call.

If User A wants to chat with one of their online buddies, they can simply double-click on the buddy's username on the DataGrid. Double-clicking invokes a new chat window to appear, which keeps a reference to the main buddy list. The buddy list window manages all the other open chat windows for that user through a WinManager object (see Figure 3).

Buddy list window as displayed in Adobe AIR

Figure 3. Buddy list window as displayed in Adobe AIR

This functionality should be familiar to most people who have used instant messaging applications in the past. By controlling the chat windows through the user's buddy list, a relationship is maintained between each user's set of chat sessions. Of course, since so many people have previously used chat applications, it also raises the bar for your own IM solution—because users expect a level of performance and set of features that they've experienced when using other chat applications.

Now that you've sketched out the basic plan for how the system works, it is time to delve into the code. The next section of this article explains how to control the opening and closing of the chat window using a WinManager object in Adobe AIR.