//声音暂停播放控制,暂停后再执行就是继续播放 //Sound: Pause (MX) //author: Madokan [+], Submitted: 02.14.03 4a Sound.prototype.switchPause = function(idName) { if (!this.spielen) { this.start(this.position/1000); this.spielen = true; } else { this.stop(idName); this.spielen = false; } }; // usage musik = new Sound(this); musik.attachSound("latino"); musik.switchPause("latino"); pause_btn.onRelease = function() { musik.switchPause("latino"); } //---------------------------------------------------------------------------------------------- //Sound: make a time gap before sound plays //author: i11uminatus [+], Submitted: 08.29.03 9a Sound.prototype.lagStart = function(lag) { this.lagPlay = function(ref){ ref.start(); clearInterval(ref.int); } this.int = setInterval(this.lagPlay, lag, this); } /* usage Sometimes you want sounds to play not at the very instant they're called, but a moment after, for instance, if the user arrives at a screen in your application it might take a moment for the graphical content to sink in before you want to give them the audio greeting. "lag" is the number of milliseconds until the sounds plays. Usage would go like this. */ mySound = new Sound(); mySound.attachSound("myAudioFile.mp3"); mySound.lagStart(1500); // The sound would start to play a second and a half after receiving the instruction. //---------------------------------------------------------------------------------------------- //Sound: Sound.prototype.percentPlayed //author: olsonjj [+], Submitted: 06.05.03 2p ? Last Edit: 06.05.03 2p Sound.prototype.percentPlayed = function() { return (this.position/this.duration)*100; }; //usage //Nothing fancy -- returns the percent that has been played. //I use this when I add voice overs to Flash presentations. //---------------------------------------------------------------------------------------------- //Sound: timeElapsed - Return the position of a sound in minuutes and seconds //author: voodoo 192 [+], Submitted: 11.27.03 9a Sound.prototype.timeElapsed = function() { var TotalSeconds = math.round(this.position/1000); var minutes = math.floor(seconds/60); var seconds = TotalSeconds-(minutes*60); return minutes+":"+seconds; };