Ok, this is what I have

One movieclip in my library with linkidentifier : vierkantje
This is a movieclip with a rectancle in it.

I managed to create instances from the object vierkantje.



when I debug the movie I kan see the new objects :

_level0.vierkantje_0
_level0.vierkantje_1
_level0.vierkantje_2


Next I want to put an onPress event on each of the objects.
When you click the object it will trace the integer that was assigned to the object.

So when you click on the first object you should get traced :

Code:
0

But it does not output 0. I always get output

Code:
2
on each of the objects.


What am I doing wrong? Please help !!!! My actionscript:

Code:
stop();

var total:Number=3;

var startX:Number=1;
var startY:Number=1;

var nextX:Number=startX;
var nextY:Number=startY;

for(i=0;i<total;i++)
{
	attachMovie("vierkantje","vierkantje_"+i,(1000+i));
	currObj=eval("vierkantje_"+i);
	
	with(currObj)
	{
		_x=nextX;
	}
	
	currObj.testId=i;
	
	currObj.onPress=function()
	{
		trace("currObj.testId = "+currObj.testId);
	}
	
	nextX+=currObj._width+2;
}