# Drag counter

**URL:** <https://forum.kirupa.com/t/drag-counter/2457>\
**Category:** Uncategorized\
**Created:** [March 31, 2002, 4:13pm UTC](https://forum.kirupa.com/t/drag-counter/2457 "2002-03-31T16:13:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 31, 2002, 4:13pm UTC](https://forum.kirupa.com/t/drag-counter/2457/1 "2002-03-31T16:13:36Z")

</div>

## Post Preview: i want to trace() the number of mc’s i drop into another mc, but i dont know how to make it, because the counter i made also counts…mouse clicks! here’s my code:

## onClipEvent(mouseUp) { if (this.hitTest(\_root.\_xmouse,\_root.\_ymouse,false)) { var v; v++; trace(v); } }

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 31, 2002, 9:42pm UTC](https://forum.kirupa.com/t/drag-counter/2457/2 "2002-03-31T21:42:49Z")

</div>

in the movie clip you are dragging put this code in the same place as the stopDrag command:  
if(\_root[\_root.mcDragged.\_droptarget].\_name==“mcTarget”){  
\_root.nDroppedOnTarget++;  
}  
where ‘nDroppedOnTarget’ increments by 1 every time you drop ‘mcDragged’ onto ‘mcTarget’.  
🙂  
jeremy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 1, 2002, 10:44am UTC](https://forum.kirupa.com/t/drag-counter/2457/3 "2002-04-01T10:44:06Z")

</div>

## thanks for helping, first of all. i used this code:

## onClipEvent (mouseUp) { &nbsp &nbsp &nbsp &nbsp if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)) { &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this.stopDrag(true); &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if(\_root[\_root.ca.\_droptarget].\_name==“gare”){ &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp var n; &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp \_root.n++; &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp trace(\_root.n); &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp } else {trace(“hmm”); }

where “ca” is the mc’s name that i drag and “gare” the mc’s name where mcs are draged into.  
they all reside in the main timeline.  
I tested with a trace(), but only the else statement works, which means nothing is beeing counted…  
Where is it going wrong?  
I confess i’m confused with all those \_root.things  
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp  
&nbsp &nbsp &nbsp &nbsp
