Groups | Blog | Home
all groups > flash actionscript > march 2006 >

flash actionscript : Detecting when an MP3 is complete


rogz
3/25/2006 11:44:55 PM
lord_of_uo
3/25/2006 11:52:31 PM
i do it the old fasion way,

look at the time on the MP3 clip,

and do the math with my frame rate and # of frames.

then i add a "stopallsounds" command at the last frame.

...if thats what your askin of course....
urami_
3/26/2006 12:00:00 AM


[quoted text, click to view]

Why bother with listeneds if you have special dedicated action just for that :

sound.onSoundComplete = function() {

Invoked automatically when a sound finishes playing




--
Regards

Urami


--



Happy New Year guys - all the best there is in the 2006 :)




<urami>
http://www.Flashfugitive.com
</urami>

<web junk free>
http://www.firefox.com
rogz
3/26/2006 12:01:07 AM
what i have is a mediadisplay control created dynamically and the just used
setMedia function to set the file that i want to play...i had a listener set up
with a video playing but it is not working now...does the media display
component detect the end of a video and an mp3 differently?
TimSymons
3/26/2006 12:49:55 AM
You should be able to use something similar to following:

var myListener:Object = new Object();
myListener.complete = function(eventObj:Object) {
trace("media is Finished");
};
myMedia.addEventListener("complete", myListener);

Was this similar to what you had before that stopped working?

Tim
TimSymons
3/26/2006 1:46:15 AM
Thanks but will that work if you play the sound through the MediaDisplay component? I wasn't sure since I have never used that component.

rogz
3/27/2006 3:46:11 PM
this is what i ended up using



_root.mcAudio = new Sound();
_root.mcAudio.loadSound(this.strAudioFolder + "/" + this.strFileName, true)
_root.mcAudio.play();
_root.mcAudio.onSoundComplete = function(){
trace("finished playing");
}
AddThis Social Bookmark Button