Accessibility

Table of Contents

Build a YChat! Instant Messenger application using Flash Lite for mobile devices

Overview of the YChat! Instant Messenger application design

After installing and configuring the software described in the previous section of this article, it is time to analyze the application's design to get a better understanding of what is going on behind the scenes. The application can be described as three separate parts. The YChat! Instant Messenger front end is a Flash interface that is displayed on the Nokia handset (or in the Device Central CS4 emulator). The Flash client connects via the Internet to the YChat! IM web proxy server, which is running on top of Apache Tomcat. The proxy server is used to connect to the Yahoo IM server (see Figure 1).

Design overview of the YChat! Instant Messenger application

Figure 1. Design overview of the YChat! Instant Messenger application

Reviewing the contents of the sample file folder

If you haven't already, be sure to download the sample files provided on the first page of this article. After you download the ZIP file, uncompress it and open the folder to review the sample files (see Figure 2).

Review the folder structure in the sample files folder

Figure 2. Review the folder structure in the sample files folder

This sample application consists of two components: the Flash Lite mobile client and the Java Servlet web proxy. The code and files for each part are provided in the following two folders:

  1. YChat! IM Adobe Flash Lite Client N95
  2. YChat! IM Web Proxy

In the following section I'll describe the contents of each folder and its subfolders.

YChat! IM Adobe Flash Lite Client N95

This top-level folder contains the YChat! Instant Messenger client code developed with Flash Lite 2.1 using ActionScript 2.0. This code was developed for the target device Nokia N95. It has been successfully tested on the device itself.

The YChat! IM Adobe Flash Lite Client N95 folder contains one subfolder, as described below:

  1. YChat!_Code

    This folder contains the actual code for the YChat! Instant Messenger client developed with Flash Lite 2.1 using ActionScript 2.0 to target the Nokia N95. The subfolder named as contains the ActionScript SDK and files that communicate with the proxy server to enable chat communications with the Yahoo IM Server. The YChat! Client.swf file is the Flash user interface that was created with Flash Lite. This client UI uses the ActionScript components provided in the as folder to communicate with the Yahoo IM Server through the proxy server. The README.txt file in this folder provides detailed information about the client settings. You can open the YChat! Client.fla file in Flash CS4 to modify the code and make further changes.

YChat! IM Web Proxy

This top-level folder contains the code for the YChat! IM web proxy server developed with Java Servlets. This web proxy facilitates communication to and from the YChat! Instant Messenger client and the YChat! IM web proxy server.

There are four subfolders in this directory:

  1. YChat! IM Web Proxy

    This folder contains the code for the YChat! IM web proxy servlet. This servlet handles all of the YChat! Instant Messenger client requests and forwards them to the Yahoo IM server. It also retrieves the appropriate data from the Yahoo IM server and sends it back to the client. You can open this code in the Eclipse IDE if you'd like to make further modifications. The README.txt file provides detailed information on the settings and configuration of the IM web proxy. The Apache Tomcat Plug-in facilitates deployment of this code from the Eclipse environment. I used the jYMSG open source library to develop the web proxy, which provides communication with the Yahoo IM server.

  2. IM Web Proxy WAR

    This folder contains the YahooIMWebProxy.WAR file that can be used to deploy the web proxy servlet on the Apache Tomcat server. Place this WAR file in the webapps directory (in the Apache Tomcat installation directory) and start Tomcat to deploy the WAR file.

    After deploying the WAR file, you can access it on a local machine by entering the URL below:

    http://localhost:8080/YahooIMWebProxy/
  3. UploadServlet_Code

    This folder contains the code for the UploadServlet. This servlet is used to upload files to the server, prior to performing file transfers. Upload this servlet file to the web server to allow files to be transferred to the respective buddy lists. You can open this file in the Eclipse IDE if you'd like to make modifications to the code. The README.txt file provides detailed information about the settings.
  4. UploadServlet_WAR

    This folder contains the UploadServlet.WAR file that is used to deploy the servlet to the Apache Tomcat server. Place this WAR file in the webapps directory (in the Apache Tomcat installation directory) and then restart Tomcat to deploy the WAR file. The README.txt file provides more information about the settings and configuration.

    After deploying the WAR file, you can access it on a local machine by entering the URL below:

    http://localhost:8080/UploadServlet/

After reviewing and setting up these files, you should have a better understanding of the sample application structure and how it is organized. In the next section, I'll provide the URLs you can use to test drive the features in the YChat! Instant Messenger application.