So I generated 65 movieclips inside a container movieclip. (It's in a container due to this being on a game and it's within a popup.) The MovieClips are created by accessing an AS3 linked MovieClip in the library. Each one is stored in an array of MovieClips. From there I put some text information (including some hidden text) into each one and add some event listeners. The code itself works just fine except for one thing. The Event Listener receives the target as one of the TextFields inside the MovieClip instead of the MovieClip itself. I made absolute certain that the Mouse Event Listeners were applied to the movieclips.
for (var i:int = 0; i < mcArray.length; i++)
{
mcArray[i] = new IDButton();
MovieClip(mcArray[i]).tf1.text = String(ID1[i])
MovieClip(mcArray[i]).tf2.text = String(ID2[i]);
MovieClip(mcArray[i]).tf3.text = String(ID3[i]);
MovieClip(mcArray[i]).tf1.selectable = false;
MovieClip(mcArray[i]).tf2.selectable = false;
MovieClip(mcArray[i]).tf3.selectable = false;
MovieClip(mcArray[i]).tf1.visible = false;
MovieClip(mcArray[i]).tf2.visible = false;
MovieClip(mcArray[i]).name = "MC" + String(i);
container.addChild(MovieClip(mcArray[i]));
MovieClip(mcArray[i]).addEventListener(MouseEvent.CLICK, mcClickHandler);
MovieClip(mcArray[i]).addEventListener(MouseEvent.ROLL_OVER, mcHoverHandler);
MovieClip(mcArray[i]).addEventListener(MouseEvent.ROLL_OUT, mcOffHandler);
MovieClip(mcArray[i]).x = 0;
MovieClip(mcArray[i]).y = MovieClip(mcArray[i]).height * i;
}
(To be honest I've no idea if having the MovieClip there is redundant. I suppose it shows my general lack of trust in flash.)
So to test I traced the target name in the mcClickHandler function and it kept returning "tf3".