# Drag and drop game

**URL:** <https://forum.kirupa.com/t/drag-and-drop-game/325599>\
**Category:** Uncategorized\
**Created:** [October 25, 2011, 3:37pm UTC](https://forum.kirupa.com/t/drag-and-drop-game/325599 "2011-10-25T15:37:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheDarklord84](https://avatars.discourse-cdn.com/v4/letter/t/bbe5ce/32.png) [@TheDarklord84](https://forum.kirupa.com/u/TheDarklord84)\
**Post date:** [October 25, 2011, 3:37pm UTC](https://forum.kirupa.com/t/drag-and-drop-game/325599/1 "2011-10-25T15:37:01Z")

</div>

Hi I’m new to this form.

I’m trying to create a drag and drop game as part of a college project.

So basically the idea is that the user will have a object which they can drag around the screen and when the object reaches a certain point of screen, it should lock into place.

But I’m having difficulty trying to lock the image.

```auto

redCircle_MC.addEventListener(MouseEvent.MOUSE_DOWN , redCircleDrag);

function redCircleDrag(event:MouseEvent):void
{

    if(redCircle_MC.X>300)
    {
    redCircle_MC.startDrag(); 
    }

};

redCircle_MC.addEventListener(MouseEvent.MOUSE_UP , redCircleStopDrag);

function redCircleStopDrag(event:MouseEvent):void
{
redCircle_MC.stopDrag(); 
};

blue_box.addEventListener(MouseEvent.MOUSE_DOWN , blueBoxDrag);

function blueBoxDrag(event:MouseEvent):void
{
blue_box.startDrag(); 
};

blue_box.addEventListener(MouseEvent.MOUSE_UP , blueBoxStopDrag);

function blueBoxStopDrag(event:MouseEvent):void
{
blue_box.stopDrag(); 
};

```

Any suggestions would be greatly appreciated.
