Referencing Movie Clips

Hello again.

I’m placing movie clips onto the Flash stage with the below AS3 code:


function fatController():void
{
	var officeEquipment:Array = new Array();
	
officeEquipment[2] = new KeyBoard;
	officeEquipment[3] = new Monitor;

setTimeout(placeObject, 		2000,		officeEquipment[2],	 1430,	225);
	setTimeout(placeObject, 	   	2000,		officeEquipment[3],	 1400,	165);

function placeObject(obj:MovieClip, posX:int, posY:int):void
{	
	//trace('placed');
	addChildAt(obj, 3);		// add this object to the stage
	
	obj.x=posX;				// move to X-Co-ordinate
	obj.y=posY;				// move to Y Co-ordinate
	
	//tween from current position to 2300 pixels to the left
	TweenLite.to(obj, 192, {x:posX-2300, useFrames:true, ease:None.easeIn});

obj.addEventListener(MouseEvent.ROLL_OVER, killObject);
}

KeyBoard and Monitor are separate movie clips, and I’m wondering how I can make Monitor gotoAndPlay when KeyBoard is moused over. I have tried placing this code in the KeyBoard movie clip:


MovieClip(root).officeEquipment[3].gotoAndPlay(2);

But it comes up with the error “Error #1010: A term is undefined and has no properties.” I understand how to do this when I place the movie clips on the timeline manually, but I’m stumped as to how to do it when they’re being placed with code!

Any ideas?

Thanks in advance.