
Chapter 3 46
3 Write the event handler onDisconnect to clean up.
application.onDisconnect = function(client)
{
trace("disconnect: " + client.name);
application.users_so.setProperty(client.name, null);
}
4
Save the file as main.asc in a doc_textchat directory under the flashcom applications directory.
Note: Save this main.asc file where you’ve chosen to store your server-side application files. For more
information see Chapter 1, “The flashcom application directory,” on page 15.
To test your sample application:
1 In the Flash MX authoring environment, after you have saved your work, publish it by
selecting File > Publish.
2 Open two instances of the SWF file in the application directory.
3 In each instance, type a user name and room name, and select Connect. (Choose different user
names but the same room name in both instances.) The logged-in users are listed in the box.
Type text and click Send, and all logged-in clients see the message.
Sample 6: Record a List
This sample lets users record a session and then choose from a playback list which session they
want to play back.
About the sample
In this sample, the user can record an audio stream, which then shows up in a playlist. The user
can also select from the playlist to play back recorded streams. Multiple users can join this
application to record and play back audio streams.
Re-creating the sample
The doc_list.fla file provides the ActionScript to create an audio playback list. By expanding upon
this sample, you can create playback lists of video sessions, text sessions, drawing sessions,
presentations, and more.
See “Creating your working environment” on page 31 before you start to re-create the sample.
To create the user interface for this sample:
1 In the Flash MX authoring environment, select File > New to open a new file.
2 From the toolbox, select the Text tool and draw a text box. In the Property inspector (Window
> Properties), select Input Text for the type of text box, and give it the instance name
ListItem.
3 To create a place for the playlist to be displayed, open the Component panel (Windows >
Components), drag the List Box component onto the Stage, and give it the instance name
Play_list.
4 To add the button for recording, drag a push button onto the Stage. In the Property inspector,
give it the instance name
Record_btn, the label Record, and the click handler doRecord.
5 To add the button for recording, drag a push button onto the Stage. In the Property inspector,
give it the instance name
Play_btn, the label Play, and the click handler doPlay.
Komentarze do niniejszej Instrukcji