# Drag function messed up

**URL:** <https://forum.kirupa.com/t/drag-function-messed-up/23125>\
**Category:** flash\
**Created:** [June 13, 2003, 5:25am UTC](https://forum.kirupa.com/t/drag-function-messed-up/23125 "2003-06-13T05:25:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meridian](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/meridian/32/243_2.png) [@Meridian](https://forum.kirupa.com/u/Meridian)\
**Post date:** [June 13, 2003, 5:25am UTC](https://forum.kirupa.com/t/drag-function-messed-up/23125/1 "2003-06-13T05:25:50Z")

</div>

I tried looking around at some drag stuff in the forums but nothing helped me and Senocular’s code scared me so I thought maybe someone could help me fix this easily 🙂

Ok so I have these 2 sexy little scale + movement functions on my movie clip

onClipEvent (load) {

easeScale = function (xscale, yscale) { \_xscale += (xscale-\_xscale)/7;\_yscale += (yscale-\_yscale)/7;};

easeMove = function (xpos, ypos) { \_x += (xpos-\_x)/7;\_y += (ypos-\_y)/7;};

}

And

On my button I have

on (release) {  
\_root.hover.onEnterFrame = function() {  
this.easeScale(10, 10);  
this.easeMove(0, 0);  
};  
}

Simple enough right?

Well, I have some buttons on the movie clip that allow me to drag it around the screen, and when I use my “easeMove” function to move the movie clip it get’s all crazy and woun’t let me drag it. If I use the scale function by its self it work just fine but ad in the move and it goes all to poo.

Link to file if you’d like to see what it’s doing first hand.  
(fyi the little blue button minizes and the first mouse over box moves the mc)

[http://www.radiofreetokyo.com/popup\_2.fla](http://www.radiofreetokyo.com/popup_2.fla)

Please help me 🙂

---

<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:** [June 13, 2003, 7:36pm UTC](https://forum.kirupa.com/t/drag-function-messed-up/23125/2 "2003-06-13T19:36:31Z")

</div>

onEnterFrame gets executed (framerate) times per second, so that’s how often your easeMove gets called, changing the \_x & \_y, and at the same time, you want to drag the poor clip, also changing those…how could Flash not go crazy with that, trying to accomodate both the function and your dragging…? 😉

---

<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:** [June 13, 2003, 11:55pm UTC](https://forum.kirupa.com/t/drag-function-messed-up/23125/3 "2003-06-13T23:55:55Z")

</div>

So how do I only make it run once per mouse down?

would an if then statement work?
