Flash error in AS3. Use a button to stop a sound.
Hi,
I have the following code:
import flash.net.URLRequest;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.Event;
import flash.events.MouseEvent;
var ruta:URLRequest=new URLRequest("afternoonnaps.wav");
var sonido:Sound = new Sound();
var canal:SoundChannel = new SoundChannel();
sonido.load(ruta);
sonido.addEventListener(Event.COMPLETE, carga);
function carga(event:Event):void {
detener_btn.addEventListener(MouseEvent.CLICK, detener);
}
function detener(event:MouseEvent):void {
canal.stop();
}
I want to stop a sound with a button and this is the error that I get:
Error #2044: IOErrorEvent Unhandled: text=Error #2032: Sequence or Stream error.
at web17_fla::MainTimeline/frame10()
Please, Can you help me?.
