MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Spezifikationen Seite 113

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 369
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 112
Sample Applications 35
6 Create the event handler for the Play button that plays the stream recorded on the server.
function doPlay() {
in_ns.play("my_recorded_stream");
}
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 the SWF file in the application directory or, in the Flash MX authoring environment,
choose Control > Test Movie.
Sample 2: Shared Text
This sample allows users to share text. Any user can update the text on the stage, and other users
can see it immediately updated on their own stages.
About the sample
User 1 opens the doc_text.html file and is able to type text in the text box. User 2 opens the same
movie and automatically connects to the same shared object. User 2 can see the text as user 1
types it. When user 2 edits the text, user 1 can view the changes as they occur.
Re-creating the sample
The doc_text.fla file uses only a few lines of code to connect to the Flash Communication Server,
create and connect to a remote shared object, and update the shared object on the Stage that all
connected clients are viewing.
This sample introduces the idea of shared objects (for more information, see the Client-Side
Communication ActionScript Dictionary). In this sample, you call
SharedObject.getRemote("sharedtext", new_nc.uri, false). These shared objects are
synchronized with the server over an RTMP connection. Shared objects consist of name-value
pairs and can be updated by any client connected to the application and the shared object.
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.
3 In the Property inspector (Window > Properties), select Input Text for the type of text box, and
give it the instance name
TypingStage.
4 Create a directory named doc_text in your flashcom application directory, and save the file as
doc_text.fla in this directory.
To write the client-side ActionScript for this sample:
1 Select the keyframe in the Timeline and open the Actions panel (Window > Actions).
Seitenansicht 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 368 369

Kommentare zu diesen Handbüchern

Keine Kommentare