mira este ejemplo espero te ayude:
    Cita:  for (var i:Number = 0; i < 30; i++)
{
 
 
	var carta:MovieClip = _root.attachMovie("carta", "carta" + i, _root.getNextHighestDepth());
	//creas una variable
	carta.id_boton = i;
	carta._x = Math.random() * 800;
	carta._y = Math.random() * 800;
 
	carta.onRelease = function()
	{
 
		trace("este es el boton numero: " + this.id_boton);
	};
}