Using Communication Components > Chat component > Using the Chat component |
![]() ![]() ![]() |
Using the Chat component
You can use this component to create a chatroom application or as a component within a larger application, as described in the following list:
![]() |
Regular chatroom: Use this component with the UserColor component, the PeopleList component, and the SimpleConnect component to create a chatroom. |
![]() |
Useful in every application: Having a Chat component in all your communication applications is useful. Text communication is efficient and can provide a backup in case audio-video communication is not convenient (for example, if users' computers have slow connections). |
To use the Chat component in your application:
1 |
Make sure that Flash Communication Server is running. |
2 |
Create an directory in the Flash Communication Server MX applications directory, and name it chat_test. |
3 |
Create a file named main.asc with the following code and save it in the chat_test directory: |
load("components.asc"); |
|
Note: You can also copy the main.asc file from another application directory to this application's directory. |
|
4 |
In Flash MX, drag the Chat component onto the Stage, and, in the Property inspector, give it an instance name, such as |
5 |
Drag the UserColor component onto the Stage, and, in the Property inspector, give it an instance name, such as |
6 |
Drag the SimpleConnect component onto the Stage. |
7 |
In the Property inspector for the SimpleConnect component, provide the following two parameters: |
![]() |
In the Application Directory text box, type the URI of the application that you created in Step 2: |
![]() |
Double-click the Communication Components text box. In the Values dialog box that appears, click the plus sign (+), type the instance name of the Chat component (for example, |
By providing these values, the SimpleConnect component handles the connection for the Chat and UserColor components. When the SimpleConnect component successfully connects to the server, the Chat and UserColor components automatically connect to the server. |
|
8 |
Save and publish this file as chat_test.swf. |
9 |
Open the SWF file or, in the Flash MX authoring environment, select Control > Test Movie, and log in. |
You can open multiple instances of the SWF file, log in as different users, and pick different text colors, as shown in the following figure. |
![]() ![]() ![]() |