AS3: how to reference a dynamic movieclip

I have a number of identical movie clips that are generated in responce to an XML file. I’m trying to reference a specific one of these movieclips after a sound file stops playing. How do I call up that specific movieclip? How can dynamically created objects be referenced through the actionscript? Thanks in advance for any help!

Here is some of my simplified test code (without all the xml junk):

for(var i = 0; i < 3; i++){
    var a = new test();
    a.x = 20 + (i * 150);
    a.addEventListener(MouseEvent.CLICK, doPlay);
    a["snd"+i] = new Sound();        
    a["snd"+i].load(new URLRequest("creak128.mp3"));
    a.snd = a["snd"+i];
    a.addEventListener(MouseEvent.CLICK, playSound, false, 0, true);

function playSound(event:MouseEvent):void {
    var voice =;
    voice.addEventListener(Event.SOUND_COMPLETE, testing);


function doPlay(e:MouseEvent){;

function testing(e:Event){
    trace("test works");