# Hittest -- drag to defined Y position

**URL:** <https://forum.kirupa.com/t/hittest-drag-to-defined-y-position/62576>\
**Category:** flash\
**Created:** [August 29, 2004, 2:13pm UTC](https://forum.kirupa.com/t/hittest-drag-to-defined-y-position/62576 "2004-08-29T14:13:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voccart](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@Voccart](https://forum.kirupa.com/u/Voccart)\
**Post date:** [August 29, 2004, 2:13pm UTC](https://forum.kirupa.com/t/hittest-drag-to-defined-y-position/62576/1 "2004-08-29T14:13:36Z")

</div>

Hi ,

i got 4 movie’s on main (category **0** \_mc, category **1** \_mc, category **2** \_mc and category **3** \_mc) the \_y position of these 4 movie’s is variable…

i want it so that when i start drag “categorie **0** \_mc” you only can drag to (category **1** \_mc, category **2** \_mc and category **3** \_mc) and when release “categorie **0** \_mc” change \_y position with the other categorie movie

i searched and find some things, but not usefull for me…

if somebody could point me to a tutorial or give a hint :d

thanks

---

<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:** [August 29, 2004, 7:02pm UTC](https://forum.kirupa.com/t/hittest-drag-to-defined-y-position/62576/2 "2004-08-29T19:02:16Z")

</div>

Something like this?

```auto

for (i=0;i<=4;i++){
   _root["categorie"+i+"_mc"].onRelease = function () {
        if (_root["categorie"+i+"_mc"].hitTest(categorie1_mc){
        _root["categorie"+i+"_mc"]._y = cateogrie1_mc._y;
        }
        if (_root["categorie"+i+"_mc"].hitTest(categorie2_mc){
        _root["categorie"+i+"_mc"]._y = cateogrie2_mc._y;
        }
       \\and so on... There maybe a more elegant way to script this.. :p
    }
}

```
