
Client-Side Communication ActionScript 53
MovieClip (object)
This object is discussed in detail in the online Flash ActionScript Dictionary in the Flash MX
Help menu. Only the method used by Flash Communication Server is discussed in this section.
Method summary for the MovieClip object
MovieClip.attachAudio
Availability
• Flash Player 6.
• Flash Communication Server MX (not required).
Usage
anyMovieClip.attachAudio(source)
Parameters
source The object containing the audio to play. Valid values are a Microphone object, a
NetStream object (requires Flash Communication Server), and
false (stops playing the audio).
Returns
Nothing.
Description
Method; specifies the audio source to be either played locally (Microphone object) or streamed
from the Flash Communication Server (NetStream object). To stop playing the audio source, pass
false for source.
• To play local audio, pass a Microphone object as source. This captures and plays local audio
from the microphone hardware.
• To play live or recorded audio streaming from the Flash Communication Server, pass a
NetStream object as
source. (The same NetStream object can contain both audio and video
information. To play back video from a NetStream object, use the
Video.attachVideo
method.)
You don’t have to use this method to play back incoming streamed audio; audio sent through a
stream is played through the subscriber’s standard audio output device by default when the
subscriber issues
NetStream.play. However, if you use this method to route streaming audio to a
movie clip, you can then create a Sound object to control some aspects of the sound.
Example
The following code attaches a microphone to a movie clip.
myMic = Microphone.get();
this.attachAudio(myMic);
See also
Microphone (object), NetStream (object), NetStream.attachAudio, Sound (object) in the
online Flash ActionScript Dictionary in the Flash MX Help menu
Method Description
MovieClip.attachAudio Starts or stops playback of an audio source.
Commenti su questo manuale