# Referencing Movie Clips

**URL:** https://forum.kirupa.com/t/referencing-movie-clips/305840
**Category:** Uncategorized
**Created:** [March 4, 2010, 12:33pm UTC](https://forum.kirupa.com/t/referencing-movie-clips/305840 "2010-03-04T12:33:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![joobny](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@joobny](https://forum.kirupa.com/u/joobny)
#### Post date: [March 4, 2010, 12:33pm UTC](https://forum.kirupa.com/t/referencing-movie-clips/305840/1 "2010-03-04T12:33:09Z")

</div>

Hello again.

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

```auto

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:

```auto

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.
