getInstanceByname

Hi Guys.

Im trying to make instance names for movie clips via a loop. Basically, every new instance of the movie clip should have an addEventlistener (mouseclick,someFunction)
What I have is ;

for (var i:Number=0; i<len; i++) {
var c:teamLineUp_mc = new teamLineUp_mc();
c.name = “players”+i;
var instanceVariable = getInstanceByName(“players”+i);
instanceVariable.addEventListener(MouseEvent.CLICK,displayDetails);

}

I can add the clips to the stage and everything; it’s just that I need to add a unique name for each instance, as there are text fileds within the movie clips that are populated by xml data.

When I click on the movie clip I will need to access the information. But for now I just need to give the movie clips new names after each loop.

Im getting error : 1180: Call to a possibly undefined method getInstanceByName.

Im not sure what the import line is (Using external as3). Currently I have ;

import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;

Any ideas ?
Cheers
D