Referencing instances of an object - newbie

Hi,

Im having a problem getting my head around referencing instances of an object in AS3, can somebody please help?

I want to be able to build a navigation and reference each navigation item separately changing each instances properties depending on rollover actions etc.

I would have thought that once the name is assigned through the for loop that would stick, eg. the following code would create 3 vars called navItem, each with the name 0, 1, 2. But it seems if I trace the name outside of the for loop each is called 2. I think Im misunderstanding something really simple!

Please help.

Thanks!

public function buildNav():void {
for (var i=0; i <itemNum; i++){
var navItem:NavItem = new NavItem ();
navItem.name = i;
navItem.x = (navItem.width+50)*i;
navItem.addEventListener(MouseEvent.MOUSE_OVER, doSomething);
navItem.count = i
stage.addChild(navItem);
if (navItem.count < 1){
navItem.gotoAndStop(2);
}
}
function doSomething (e:MouseEvent):void {
trace (navItem.name);
}
}