stopAllSounds()
713
stopAllSounds()
Availability
Flash Player 3.
Usage
stopAllSounds()
: Void
Parameters
None.
Returns
Nothing.
Description
Function; stops all sounds currently playing in a SWF file without stopping the playhead. Sounds
set to stream will resume playing as the playhead moves over the frames in which they are located.
Example
The following code creates a text field, in which the song’s ID3 information appears. A new
Sound object instance is created, and your MP3 is loaded into the SWF file. ID3 information is
extracted from the sound file. When the user clicks
stop_mc,
the sound is paused. When the user
clicks
play_mc,
the song resumes from its paused position.
this.createTextField("songinfo_txt", this.getNextHighestDepth, 0, 0,
Stage.width, 22);
var bg_sound:Sound = new Sound();
bg_sound.loadSound("yourSong.mp3", true);
bg_sound.onID3 = function() {
songinfo_txt.text = "("+this.id3.") "+this.id3.album+" -
"+this.id3.track+" - "+this.id3.songname;
for (prop in this.id3) {
trace(prop+" = "+this.id3[prop]);
}
trace("ID3 loaded.");
};
this.play_mc.onRelease = function() {
/* get the current offset. if you stop all sounds and click the play button,
the MP3 continues from where it was stopped, instead of restarting from the
beginning. */
var numSecondsOffset:Number = (bg_sound.position/1000);
bg_sound.start(numSecondsOffset);
};
this.stop_mc.onRelease = function() {
stopAllSounds();
};
See also
Sound class
CHAPTER 7
ActionScript for Flash
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
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...