Jump to content
Search Community

Audio Stop?

donaldleegraham test
Moderator Tag

Recommended Posts

Hi All,

 

I was curious if there was some sort of stop command within LoaderMax? I'm building a mobile MP3 player and it loads fine every time the player launches, but the issue is caused when I hit the Play/Pause button. It works right the first time... playing & pausing. Next time I load it, and hit the Play/Pause button I get, "ArgumentError: Error #2068: Invalid sound."

 

I have unload and dispose being called during my closeFunction, but I don't think it is working.

 

When I click the menu item it autoPlays just fine. When I close it stops. Then I click on a different menu item, it loads and plays fine. I'm just having issues with the silly Play/Pause button. :?

 

 

 

//This is the data for my scrollable menu as well as the associated audio.
draggableList.dataProvider = [
			{id: "1", title: "Introduction", audio: "http://mydomain.com/00.mp3", description: "Introduction"},
			{id: "2", title: "Chapter 1",  audio: "http://mydomain.com/01qa.mp3", description: "Chapter 1"},
			{id: "3", title: "Chapter 1", audio: "http://mydomain.com/01.mp3", description: "Practice"},
];

var o:Object = draggableList.selectedItem;

var sound:MP3Loader = new MP3Loader(o.audio, {name:"audio", autoPlay:true});
sound.load();

playPauseBtn.addEventListener(MouseEvent.CLICK, playPauseFunction);
closeBtn.addEventListener(MouseEvent.CLICK, closeFunction);

function playPauseFunction(event:MouseEvent):void {
sound.soundPaused = !sound.soundPaused;
}
function closeFunction(event:MouseEvent):void {
sound.dispose(true);
       sound.unload();
trace("CLOSE");
}


Link to comment
Share on other sites

Hi Donald,

 

I don't see any code that would illustrate how the "re-load" happens.

 

I would think to re-load the sound after you have disposed and unloaded it, you would have to re-declare a NEW sound.

 

I was expecting to see an eventListener of some type on your draggableList that would update what sound is every time a new item was selected.

 

from what I'm seeing I can only guess this is not happening. once you dispose sound, it no longer exists, so playing it isn't going to work.

 

make sense?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...