# Associative Array Question

**URL:** <https://forum.kirupa.com/t/associative-array-question/249057>\
**Category:** flash\
**Created:** [January 14, 2008, 10:57pm UTC](https://forum.kirupa.com/t/associative-array-question/249057 "2008-01-14T22:57:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![No\_44](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@No\_44](https://forum.kirupa.com/u/No_44)\
**Post date:** [January 14, 2008, 10:57pm UTC](https://forum.kirupa.com/t/associative-array-question/249057/1 "2008-01-14T22:57:47Z")

</div>

Hello all,

I am having an interesting problem on a flash game that I am trying to create. Basically, I am trying to create multiple copies of the same MC and allow users to position them in various places around the stage. Thus, I am trying to use an associative array to do this. Here is my code:

on the root:

```auto
 
var itemList:Object = new Object();

```

on the button to create the duplicate clip:

```auto
 
on (press) {
 b++;
 //Deskdragmovie.duplicateMovieClip("Deskdragmovie" + b, this.getNextHighestDepth(), {_x:400, _y:150});
 //var mc2:MovieClip = eval("Deskdragmovie" + b);
 var mc2:MovieClip = Deskdragmovie.duplicateMovieClip("Deskdragmovie" + b, this.getNextHighestDepth(), {_x:400, _y:150});
 var objdesk:Object = new Object();
 objdesk._name = mc2._name;
 objdesk._x = mc2._x;
 objdesk._y = mc2._y;
 objdesk._rotation = mc2._rotation;
 objdesk.depth = mc2.getDepth();
 this._root.itemList[objdesk._name] = objdesk;
}

```

Finally - here is the code to trace the results:

```auto
 
on(press) {
 for( var prop in _root.itemList){
 trace(_root.itemList[prop]._name);
 trace(_root.itemList[prop]._x);
 trace(_root.itemList[prop]._y);
 trace(_root.itemList[prop]._rotation);
 trace(_root.itemList[prop].depth);
 }
}

```

The problem is that on the trace, the \_x, and \_y are traced as \_x:400, \_y:150, just as the x/y that I set the duplicated clip to, even though it has been dragged to a different position. Also, the rotation is not working, although the name and depth are working fine.

I eventually want to store these positions in a database so that the user can return and see the room they designed with the MCs at a later date.

Thank you all so very much for your time and help!!!
