MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Specifiche Pagina 149

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 369
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 148
Application Development Tips and Tricks 71
The following client-side ActionScript code in doc_snapshot.fla connects to the server and plays
camera output locally. When the user chooses to take a snapshot, the event handler,
doRecord,
makes a call to out_ns.attachVideo(client_cam, 0). The second parameter, 0, causes just
one frame to be recorded.
#include "NetDebug.as"
stop();
// Recording state variable
RecState_box.text = 0;
// Number of snapshots
numSnaps = 0;
// Initialize button label
Record_btn.setLabel("Record");
// Connect to the snapshot app and get connection status
function doConnect() {
client_nc = new NetConnection();
client_nc.onStatus = function(info) {
trace("Level: " + info.level + newline + "Code: " + info.code);
};
client_nc.connect("rtmp:/doc_snapshot/room_01");
}
// Create a stream for recording and getting the snapshot
function initStreams() {
// Stream for recording
out_ns = new NetStream(client_nc);
out_ns.onStatus = function(info) {
trace("Level: " + info.level + newline + "Code: " + info.code);
};
// Stream for playing
in_ns = new NetStream(client_nc);
in_ns.onStatus = function(info) {
trace("Level: " + info.level + newline + "Code: " + info.code);
};
}
// Get a camera instance and attach it to the local
// video, Live_video, and the output stream
client_cam = Camera.get();
Live_video.attachVideo(client_cam);
// Button event handler for publishing and showing the snapshot
function doRecord() {
// If you’re not recording, begin to record
if (RecState_box.text == 0) {
// Clear the snapshot window
Snapshot_mc.removeMovieClip();
// Take a snapshot
out_ns.attachVideo(client_cam, 0);
out_ns.publish("myRecording"+numSnaps, "record");
// Set the label to stop
Record_btn.setLabel("Stop");
// Update the recording state
RecState_box.text = 1;
// If you’re recording, stop
Vedere la pagina 148
1 2 ... 144 145 146 147 148 149 150 151 152 153 154 ... 368 369

Commenti su questo manuale

Nessun commento