Viper Creations
Comeback Contest
Check out our forums for the an explosive comeback contest. We are giving away everything from iPods to Visual Studio. more...
»User: »Password:   Remember Me? 
Posted:  02 Jul 2008 07:46
Hi guys,

could u tell me whats wrong with this code please,it's just to load and play a song knowing that the directory of the song is correct,when i compile it doesnt read it and i dont get the message mp3 loaded in my console.
i'm using flex 3.

package {
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.media.Sound;
    import flash.net.URLRequest;
   
    public class Audio1 extends MovieClip
    {
        public var sound:Sound;
       
        public function Audio1()
        {
            sound = new Sound();
            var request:URLRequest = new URLRequest("Audio1/Audio1/demo.mp3");
            sound.load(request);
            sound.addEventListener(Event.COMPLETE, onLoad);
            sound.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
            sound.play();
        }
    private function onLoad(event:Event):void
    {
    trace("mp3 loaded");
    }
    private function onIOError(event:IOErrorEvent):void
    {}

    }
}