62
Client-Side ActionScript Language Reference
MovieClip.attachAudio()
Availability
■
Flash Player 6.
■
Flash Media Server (not required).
Usage
public attachAudio(
source
: Object) : Void
Parameters
source
The object containing the audio to play. Valid values are a Microphone object, a
NetStream object (requires Flash Media 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 Media 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 Media 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.
NO
TE
In Flash Player 7 and later,
source
can also be a NetStream object playing an FLV file
without the use of Flash Media Server. For more information, see the NetStream class
entry in
ActionScript 2.0 Language Reference
.