Hi Guys,
i´m having a “small” problem:
I´ve loaded a Mp3 Song with this code:
var song:SoundChannel;
snd = new Sound();
snd.load(new URLRequest("myMusic.mp3"));
song = snd.play();
and also created a “FX” Sound (very short sound) with almost the same code:
clickSound = new Sound();
clickSound.load(new URLRequest("click.mp3"));
And added a KeyListener to my stage:
with
stage.addEventListener(KeyboardEvent.KEY_DOWN, key_down);
and that´s my key_down method:
private function key_down(e:KeyboardEvent):void {
clickSound.play();
}
What it should do is fire this clickSound whenever i press any key.
The problem is:
If i have the song playing in background there is a HUGE delay (around 1s or more) when i press anykey to hear the sound.
The method key_down is called with no delay (i´ve traced it to test), just the sound that come delayed.
If there is no music in Background, there is no delay, so i´m assuming it´s something wrong when i play 2 sounds.
Am i doing something wrong to play these 2 files ?
Thanks all
Cheers…
PG