03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

stopAllSounds function<br />

stopAllSounds() : Void<br />

Stops all sounds currently playing in a SWF file without stopping the playhead. Sounds set to<br />

stream will resume playing as the playhead moves over the frames in which they are located.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 3<br />

Example<br />

The following code creates a text field, in which the song's ID3 information appears. A new<br />

Sound object instance is created, <strong>and</strong> your MP3 is loaded into the SWF file. ID3 information<br />

is extracted from the sound file. When the user clicks stop_mc, the sound is paused. When<br />

the user clicks play_mc, the song resumes from its paused position.<br />

this.createTextField("songinfo_txt", this.getNextHighestDepth, 0, 0,<br />

Stage.width, 22);<br />

var bg_sound:Sound = new Sound();<br />

bg_sound.loadSound("yourSong.mp3", true);<br />

bg_sound.onID3 = function() {<br />

songinfo_txt.text = "(" + this.id3.artist + ") " + this.id3.album + " - " +<br />

this.id3.track + " - "<br />

+ this.id3.songname;<br />

for (prop in this.id3) {<br />

trace(prop+" = "+this.id3[prop]);<br />

}<br />

trace("ID3 loaded.");<br />

};<br />

this.play_mc.onRelease = function() {<br />

/* get the current offset. if you stop all sounds <strong>and</strong> click the play<br />

button, the MP3 continues from<br />

where it was stopped, instead of restarting from the beginning. */<br />

var numSecondsOffset:Number = (bg_sound.position/1000);<br />

bg_sound.start(numSecondsOffset);<br />

};<br />

this.stop_mc.onRelease = function() {<br />

stopAllSounds();<br />

};<br />

See also<br />

Sound<br />

stopDrag function<br />

stopDrag() : Void<br />

Stops the current drag operation.<br />

108 <strong>ActionScript</strong> language elements

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!