# Attach multiple movies with onMouseDown for each

**URL:** <https://forum.kirupa.com/t/attach-multiple-movies-with-onmousedown-for-each/171130>\
**Category:** flash\
**Created:** [December 2, 2005, 2:30am UTC](https://forum.kirupa.com/t/attach-multiple-movies-with-onmousedown-for-each/171130 "2005-12-02T02:30:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quongo](https://avatars.discourse-cdn.com/v4/letter/q/6de8d8/32.png) [@quongo](https://forum.kirupa.com/u/quongo)\
**Post date:** [December 2, 2005, 2:30am UTC](https://forum.kirupa.com/t/attach-multiple-movies-with-onmousedown-for-each/171130/1 "2005-12-02T02:30:43Z")

</div>

I am having problems with attaching multiple instances of the same mc, and tring to get an onMouseDown event for each of them.

The problem is that if I mousedown on one of the attached mc’s, then all the attached mc’s will trigger the onMouseDown event instead of only the one I clicked on.

the trace returns “onMouseDown called on 1” …“n” instead of a single trace statement.

code:

function createSlideIcons(num){  
var targetMC:MovieClip = this.form1.slideNav.slider;  
var spacer = 5;  
for(var x:Number=0;x\<num;x++){  
var newX:Number = x \* (60 + spacer);  
var slideID:Number = x+1;  
slideDepth = targetMC.getNextHighestDepth();  
var currentIcon = targetMC.attachMovie(“slideIcon\_mc”, “slide\_”+ slideID , slideDepth, {\_x:newX, onMouseDown:selectSlide});  
trace(currentIcon);  
currentIcon.slideTxt.text = slideID;  
}  
}  
selectSlide = function () {  
trace ("onMouseDown called on " + this.slideTxt.text);  
}

Help please!!! Any suggestions on how to correct this???

PS. this is my first post!!!
