Jump to content

Play button does not work [actionscript 3]


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();
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.