Jump to content

Play button does not work [actionscript 3]


Pain

Recommended Posts

Hello everyone.

 

Im trying to make background music play at startup. I also need a play button and a stop button.

 

My music plays, but when i click on stop and then play again, heres what i get:

 

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.

at MYPROJECT_fla::MainTimeline/frame1()

ArgumentError: Error #2068: Invalid sound.

at flash.media::Sound/play()

at MYPROJECT_fla::MainTimeline/playSound()

 

 

 

What does it mean? How can i sort this out? Thank you

 

var mySound:Sound = new Sound();
mySound.load(new URLRequest("pow.mp3"));
var channel:SoundChannel = new SoundChannel();


//----Add an event listener to the Play button
btnPlay.addEventListener(MouseEvent.CLICK,playSound);

function playSound(event:MouseEvent):void {
channel = mySound.play()
}

//----Add an event listener to the Stop button
btnStop.addEventListener(MouseEvent.CLICK,stopSound);

function stopSound(event:MouseEvent):void {
SoundMixer.stopAll();
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.