# Targeting dynamiclly created movie clip

**URL:** https://forum.kirupa.com/t/targeting-dynamiclly-created-movie-clip/297681
**Category:** Uncategorized
**Created:** [October 7, 2009, 3:29am UTC](https://forum.kirupa.com/t/targeting-dynamiclly-created-movie-clip/297681 "2009-10-07T03:29:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![phastings](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@phastings](https://forum.kirupa.com/u/phastings)
#### Post date: [October 7, 2009, 3:29am UTC](https://forum.kirupa.com/t/targeting-dynamiclly-created-movie-clip/297681/1 "2009-10-07T03:29:17Z")

</div>

i’m creating a menu where i place movieclips dynamiclly:

for each (var button:XML in XMLgothrough) {

```
    //Create a new menu item
    var menuItem:MenuItem=new MenuItem ;
    menuItem.name="menuItem"+count;

    //Position the menu item with some padding (space between the items)
    menuItem.x=0;
    menuItem.y=count*menuItem.height*1.33;

```

…

in another function i try and move one of the menu items:

function itemClicked(e:Event):void {

```
               menuItem1.x=100;

```

}

but i keep getting a ReferenceError: Error #1065: Variable menuItem1 is not defined.  
at MethodInfo-359()  
error.

any ideas what i’m doing wrong?
