I'm struggeling with a problem where, in Chrome on Mac and in Chrome, Opera and Safari on PC, it appears to be playing sounds twice, generating an unwanted echo-effect with a rather random delay(always under half a second though).
I have 2 swf-files that communictes through a LocalConnection, the main swf simply calls a function on the second swf and passing a url to an mp3-file as parameter. The second swf then loads the file and onComplete plays it.
This works perfectly on IE(that's a first) and Firefox on both mac and PC but echoes as mentioned above.
I even implemented a double-check to make sure a sound wouldn't play if a sound is already playing.
Some sample code:
var audio:Sound;
var isPlayingSound:Boolean = false;
var soundURL:String;
public function lcRecieve(url:String = ""):void{
soundURL = url;
if (soundOn && !isPlayingSound){
playSound();
}
}
public function playSound():void {
if(!isPlayingSound){
audio = new Sound(new URLRequest(soundURL));
audio.addEventListener(Event.COMPLETE, onSoundComplete);
}
}
public function onSoundComplete(e:Event):void{
audio.play(0, 1).addEventListener(Event.SOUND_COMPLETE, soundFinnishedPlaying);
isPlayingSound = true;
}
private function soundFinnishedPlaying(e:Event):void {
e.target.removeEventListener(Event.SOUND_COMPLETE, soundFinnishedPlaying);
audio = null;
isPlayingSound = false;
}
Anyone stumbeled upon this problem before? I'm very much lost.