# Drag And Drop - droptarget

**URL:** <https://forum.kirupa.com/t/drag-and-drop-droptarget/147525>\
**Category:** Uncategorized\
**Created:** [May 11, 2005, 1:19pm UTC](https://forum.kirupa.com/t/drag-and-drop-droptarget/147525 "2005-05-11T13:19:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crazyzero](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@crazyzero](https://forum.kirupa.com/u/crazyzero)\
**Post date:** [May 11, 2005, 1:19pm UTC](https://forum.kirupa.com/t/drag-and-drop-droptarget/147525/1 "2005-05-11T13:19:17Z")

</div>

Hi, im new with AS, i dont know what im doing wron , i want to make flash drag a ball onpress and if its onrelease and if its on the Suquare movieclip it should stop draggin.

my code is like this

dynamic class Ball extends MovieClip  
{

```
function onPress()
{
    var x_pos = this._x;
    var y_pos = this._y;
    startDrag(this.Ball);
}

function onRelease()
{
    if (this._droptarget == "_root.Square")
    {
        stopDrag();
    }else {
        x_pos = 20;
        y_pos = 20;
    }
        
}

```

}

can someone help me out plz.

greets
