Hi guys,

I am working on a mp3 player that receives a javascript call with the name of the file to be loaded. On the first call from JS, it plays fine, but if another file is selected it fails. It only works once, in other words. I tried putting the new Sound() and new SoundChannel() inside of my playAudioA function, but then I just get endless layers of audio, AND my other functions that reference the Sound and the SoundChannel die.

Can someone take a look and tell me where I'm going wrong?


ExternalInterface.addCallback("playAudio",playAudioA);

var s:Sound = new Sound();
var sc:SoundChannel = new SoundChannel();
                                
function playAudioA(audioPath, audioImage, trackid):void
{

        try {
        s.close();
        }
        catch (error:IOError) {
        }

        var req:URLRequest = new URLRequest(audioPath);
        s.load(req);
        s.addEventListener(ProgressEvent.PROGRESS, loadProgress);
        s.addEventListener(Event.COMPLETE, loadDone);
        sc = s.play();
}       




Thank you!
--
Carl Welch
http://www.carlwelch.com
http://www.jointjam.com
[EMAIL PROTECTED]
805.403.4819




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to