Trying to load and play sound with buttons

Hi everybody!

I’ve been trying to make some buttons to load and play (in stream) determined sounds, but Error compiler shows error 2007, and I really don’t understand why listener it’s getting a null value. Can anyone help me?:hang:

Here is the code:


import flash.media.Sound;
import flash.media.SoundLoaderContext;
import flash.net.URLRequest;
var s:Sound = new Sound();

var tocarSonido = function (req:String){
    //trace (req);
var context:SoundLoaderContext = new SoundLoaderContext(1000, true);
s.load(new URLRequest(req+".mp3"), context);
s.play();
}

a_btn.addEventListener(MouseEvent.CLICK, tocarSonido("a"));
b_btn.addEventListener(MouseEvent.CLICK, tocarSonido("b"));