
Sample Applications 33
Re-creating the sample
The doc_record.fla file provides the ActionScript for getting a camera, attaching it to a Video
object, creating a network connection to the server, recording the camera data on an outgoing
stream to the server, and then playing that recorded stream in a second Video object.
When you record a stream in a Flash application, the server creates files with the extensions .flv
and .idx. For more information, see “Recorded stream files” on page 68.
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 To add a Video object to your library, open the Library panel (Window > Library) and add an
embedded Video object by selecting New Video from the library’s Options menu.
3 Drag two embedded Video objects from the library onto the Stage, and give them the instance
names
Live_video and Replay_video.
4 To add buttons to your movie, open the Components panel by selecting Window >
Components.
5 To add the button for recording, drag a push button from the Components panel onto the
Stage, placing it below the
Live_video video object. In the Property inspector, give it the
instance name
Record_btn, the label Record, and the click handler doRecord.
6 To add the button for playing, repeat the previous step to create a push button with the
instance name
Play_btn, the label Play, and the click handler doPlay. Place this button
beneath the
Replay_video video object.
7 To add the privacy message, select the Text tool and draw a text box. In the Property inspector,
select Static Text for the type of text box. Type (or copy and paste) text such as the following
text into the text box: Your image will be recorded or broadcasted and could be published at
a later date. If you don’t approve, please exit this application.
Note: Please note that this text is provided merely as an example, and the precise wording of the text that you
use will be dictated by the nature of your application and/or service and any privacy, legal, or other issues raised
by your application and/or service.
8 Create a directory named doc_record in your flashcom application directory, and save the file
as doc_record.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).
2 In the Actions panel, stop the progress of the movie.
stop();
3
Get and attach a camera.
// Attach the video device output from client_cam
// to the Live_video video clip
client_cam = Camera.get();
Live_video.attachVideo(client_cam);
Comentários a estes Manuais