# Problem with dynamic movie dragging

**URL:** <https://forum.kirupa.com/t/problem-with-dynamic-movie-dragging/265129>\
**Category:** flash\
**Created:** [July 4, 2008, 10:44am UTC](https://forum.kirupa.com/t/problem-with-dynamic-movie-dragging/265129 "2008-07-04T10:44:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![santhosh2008](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@santhosh2008](https://forum.kirupa.com/u/santhosh2008)\
**Post date:** [July 4, 2008, 10:44am UTC](https://forum.kirupa.com/t/problem-with-dynamic-movie-dragging/265129/1 "2008-07-04T10:44:38Z")

</div>

Hi,  
I am trying to drag my dynamic moviclips. But this code does not work properly.  
I have to mosue click the movie clip, and once again use mousepress to drag the movie clip.  
Is there an way o eliminate the two clicks? Thanking you in advance.  
Here is the code.

clickAction = function (\_arg2) {  
//info.\_y += 150;  
trace(“click”+\_arg2); // \_arg2 contains name of dynamic movieclip

\_arg2.onPress = function (){  
trace(“on press”+\_arg2);  
\_arg2.startDrag();  
// further code  
}

\_arg2.onRelease = function (){  
\_arg2.stopDrag();  
// further code  
}  
}

//code for creating dynamic movieclip

for (i=0; i \< xmlnodecount; i++) {

\_root.content\_mc.image\_mc.duplicateMovieClip(“image\_mc”+i, i);

```
_root.content_mc["image_mc" + i]._x = imageWidth * xinc; ;
_root.content_mc["image_mc"+i]._y = yinc;
loadMovie(image*,_root..content_mc["image_mc"+i].holder);

```

}

---

<div class="post-metadata">

**Author:** ![pantas](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@pantas](https://forum.kirupa.com/u/pantas)\
**Post date:** [July 4, 2008, 11:06am UTC](https://forum.kirupa.com/t/problem-with-dynamic-movie-dragging/265129/2 "2008-07-04T11:06:10Z")

</div>

what was that click action? you dont need it!  
[AS]

//code for creating dynamic movieclip

for (i=0; i \< xmlnodecount; i++) {

var MC:MovieCLip = \_root.content\_mc.image\_mc.duplicateMovieClip(“imag e\_mc”+i, i);

MC.\_x = imageWidth \* xinc; ;  
MC.\_y = yinc;  
loadMovie(image\*,MC.holder);  
MC.onPress = function (){  
trace(“on press”+\_arg2);  
this.startDrag();  
// further code  
}

MC.onRelease = function (){  
this.stopDrag();  
// further code  
}

}

[/AS]

is this what you were looking for?  
now you can click all the mcs…

---

<div class="post-metadata">

**Author:** ![santhosh2008](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@santhosh2008](https://forum.kirupa.com/u/santhosh2008)\
**Post date:** [July 4, 2008, 11:39am UTC](https://forum.kirupa.com/t/problem-with-dynamic-movie-dragging/265129/3 "2008-07-04T11:39:42Z")

</div>

Thank you for the immediate reply. My problem is solved with the above code.

---

<div class="post-metadata">

**Author:** ![pantas](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@pantas](https://forum.kirupa.com/u/pantas)\
**Post date:** [July 4, 2008, 2:01pm UTC](https://forum.kirupa.com/t/problem-with-dynamic-movie-dragging/265129/4 "2008-07-04T14:01:14Z")

</div>

i’m glad i was usefull!

good work 😉
