Share Posted January 14, 2015 Can't make playback listeners works. SOUND_PLAY, SOUND_PAUSE etc. just don't shoot import com.greensock.*; import com.greensock.events.*; import com.greensock.easing.*; import com.greensock.plugins.*; import com.greensock.loading.*; import com.greensock.loading.display.*; var queue:LoaderMax = new LoaderMax({name:"mainQueue", onComplete:completeHandler, onError:errorHandler}); var sound:MP3Loader = new MP3Loader("test.mp3", {name:"audio", autoPlay:true, estimatedBytes:950000}); queue.append(sound); queue.load(); function completeHandler(event:LoaderEvent) { sound.addEventListener(MP3Loader.SOUND_PLAY, soundStart); sound.addEventListener(MP3Loader.SOUND_PAUSE, soundPause); } function soundStart(event:LoaderEvent) { trace("> Start"); } function soundPause(event:LoaderEvent) { trace("> Pause"); } function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } Link to comment Share on other sites More sharing options...
Share Posted January 14, 2015 Hi It appears you are waiting for the sound to complete loading until you assign your eventListeners. Since you have autoPlay:true, your sound will start playing before it is fully downloaded. autoPlay : Boolean - By default the MP3 will begin playing immediately when enough of the file has buffered, but to prevent it from autoPlaying, set autoPlay to false. Try this //take these out of the completeHandler sound.addEventListener(MP3Loader.SOUND_PLAY, soundStart); sound.addEventListener(MP3Loader.SOUND_PAUSE, soundPause); function completeHandler(event:LoaderEvent) { trace("> done loading"); } function soundStart(event:LoaderEvent) { trace("> Start"); } function soundPause(event:LoaderEvent) { trace("> Pause"); } function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } Link to comment Share on other sites More sharing options...
Author Share Posted January 14, 2015 Yep, that works 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now