# Duplicating MCs at Mouse position?

**URL:** <https://forum.kirupa.com/t/duplicating-mcs-at-mouse-position/256729>\
**Category:** flash\
**Created:** [April 6, 2008, 4:55pm UTC](https://forum.kirupa.com/t/duplicating-mcs-at-mouse-position/256729 "2008-04-06T16:55:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laver2k](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/laver2k/32/3320_2.png) [@laver2k](https://forum.kirupa.com/u/laver2k)\
**Post date:** [April 6, 2008, 4:55pm UTC](https://forum.kirupa.com/t/duplicating-mcs-at-mouse-position/256729/1 "2008-04-06T16:55:49Z")

</div>

Hi all, sorry to ask such a basic question. Took a break from AS and now struggling to get back into it!

Im trying to create a spraycan that when the user holds down the left mouse button, creates foam movieclips at its point.

Im using startdrag to enable the can to be a cursor.

I was trying to put some script to the actual foam MC and have it triggering on mousedown. I guess Im not getting the code right:

onClipEvent(mouseDown) {

```
mc_foam.duplicateMovieClip("newfoam"+i, i);
     _root["newfoam"+i]._x=_xmouse;
 _root["newfoam"+i]._y=_ymouse;

```

}

No luck! Any ideas would be appreciated.
