Accessing object from array via event listener?

Hello,

I’m pretty new to AS3, but I have not managed to solve the following problem: basically adding instances of a bitmap on the stage (working), but then adding an event listener and knowing which is which. So for the first part:

AnArray:Array = New Array();
AnArray[1] = New Object();
AnArray[1].mainobject = New Makeabitmap(somedata);
AnArray[1].mainobjectid = 1;
addChild(AnArray[1].mainobject);
AnArray[2] = New Object();
AnArray[2].mainobject = New Makeabitmap(somedata);
AnArray[2].mainobjectid = 2;
addChild(AnArray[2].mainobject);

But if I add event listeners, how to retrieve the value of mainobjectid?

addEventListener(MouseEvent.MOUSE_OVER,somefunction);

function somefunction(event:MouseEvent) {
trace(event.target.name);
}

So it will return “[Makeabitmap Object]” … but how do I fetch the objectid value from there?

Any help would be greatly appreciated !!

Cheers,

Jim.