03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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 />

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 />

Global Functions 79

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

Saved successfully!

Ooh no, something went wrong!