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

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 369
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 125
Chapter 3 48
6 Remember to connect the shared object to the NetConnection object.
// Connect to the shared object
rec_so.connect(client_nc);
7
Create an event handler for when the user selects Record, which publishes the new recordings
and updates the shared object.
function doRecord() {
if (ListItem.text == undefined || ListItem.text == "") {
Status_msg.text="Please enter a title.";
} else if (Record_btn.getLabel() == "Record") {
Status_msg.text="Recording...";
// Stop any currently playing stream
if (Play_btn.getLabel() == "Stop")
doPlay();
// Don’t allow the user to play while recording
Play_btn.setEnabled(false);
// Create output stream
out_ns = new NetStream(client_nc);
// Start publishing the audio output as a recorded stream
out_ns.attachAudio(Microphone.get());
// Publish the stream
out_ns.publish(ListItem.text, "record");
// This allows the entering of single-word list items
_root.rec_so.data[ListItem.text] = ListItem.text;
_root.rec_so.flush();
// Change the button label
Record_btn.setLabel("Stop");
8
If the button label is Stop, close the output stream and allow the user to play from the list.
} else if (Record_btn.getLabel() == "Stop") {
// Close output stream
out_ns.close();
// Now that you’re finished recording, allow the user to play
Play_btn.setEnabled(true);
// Change the button label
Record_btn.setLabel("Record");
// Clear the ListItem.text
ListItem.text="";
Status_msg.text="...";
}
}
Vedere la pagina 125
1 2 ... 121 122 123 124 125 126 127 128 129 130 131 ... 368 369

Commenti su questo manuale

Nessun commento