MovieClip.attachAudio()
559
// replace with your own image or use the following
holder_mc.image_mc.loadMovie("http://www.macromedia.com/devnet/mx/blueprint/
articles/nielsen/spotlight_jnielsen.jpg");
holder_mc.onRollOver = function() {
this._alpha = 50;
};
holder_mc.onRollOut = function() {
this._alpha = 100;
};
See also
TextField._alpha
,
MovieClip._visible
MovieClip.attachAudio()
Availability
Flash Player 6; the ability to attach audio from Flash Video (FLV) files was added in Flash
Player 7.
Usage
my_mc
.attachAudio(
source:Object
)
: Void
Parameters
source
The object containing the audio to play. Valid values are a Microphone object, a
NetStream object that is playing an FLV file, and
false
(stops playing the audio).
Returns
Nothing.
Description
Method; specifies the audio source to be played. To stop playing the audio source, pass
false
for
source
.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Example
The following code creates a new NetStream connection. Add a new Video symbol by opening
the Library panel and selecting New Video from the Library options menu. Give it the instance
name
my_video
. Dynamically load the FLV video at runtime. Use the
attachAudio()
method to
attach the audio from the FLV file to a movie clip on the Stage. Then you can control the audio in
the movie clip using the Sound class and two buttons called
volUp_btn
and
volDown_btn
:
var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.play("yourVideo.flv");
this.createEmptyMovieClip("flv_mc", this.getNextHighestDepth());
flv_mc.attachAudio(my_ns);
var audio_sound:Sound = new Sound(flv_mc);
// add volume buttons
Summary of Contents for FLEX
Page 1: ...Flex ActionScript Language Reference ...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0 ...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally ...
Page 135: ...case 135 See also break default strict equality switch ...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while ...
Page 808: ...808 Chapter 7 ActionScript for Flash ...
Page 810: ...810 Appendix A Deprecated Flash 4 operators ...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code ...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values ...
Page 822: ...822 Index ...