# Drag and drop

**URL:** <https://forum.kirupa.com/t/drag-and-drop/102203>\
**Category:** Uncategorized\
**Created:** [February 20, 2004, 9:04pm UTC](https://forum.kirupa.com/t/drag-and-drop/102203 "2004-02-20T21:04:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixiesparkles13](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@pixiesparkles13](https://forum.kirupa.com/u/pixiesparkles13)\
**Post date:** [February 20, 2004, 9:04pm UTC](https://forum.kirupa.com/t/drag-and-drop/102203/1 "2004-02-20T21:04:50Z")

</div>

Hello

I have created a drag and drop flash movie…  
There are two choices where the user can drag  
a number of different items…if its the wrong choice  
than the item returns back to its orignal spot.  
This works fine, but I was wondering how I can put a  
response like “sorry wrong choice” or “thats correct”  
Also after all the items are in thier correct places, I would like  
to have something come up and say “congratulations, you  
have matched all the items successfully!”

Here is the code I am using so far…

on (press) {  
startDrag(this);  
this.swapDepths(100);

}  
on (release) {  
stopDrag();  
if (this.\_droptarget=="/target1") {  
\_root.business.gotoAndStop(2)  
} else {  
setProperty(this, \_x, 42);  
setProperty(this, \_y, 127);  
}  
}

Gracious thanks in advance for any help!

* * *

_Sparkling the World_

---

<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:** [February 20, 2004, 9:11pm UTC](https://forum.kirupa.com/t/drag-and-drop/102203/2 "2004-02-20T21:11:55Z")

</div>

First make a dynamic text box that will say wrong or correct. Give it a variable name of **dropResponse**. After that, replace your current code above in the previous post to this:

```auto

on (press) {
startDrag(this);
this.swapDepths(100);
}

on (release) {
stopDrag();
if (this._droptarget=="/target1") {
_root.business.gotoAndStop(2);
_root.dropResponse = "That's Correct.";
} else {
setProperty(this, _x, 42);
setProperty(this, _y, 127);
_root.dropResponse = "That's Incorrect. Try Again.";
}
}

```

Next if you want like a congratulation message, tell me what the object and it’s drop target is for every object. From there you can use if statements along with the and operator to check if all are dropped correctly, thus giving a congratulations response.

- Sharif :thumb:

---

<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:** [February 20, 2004, 9:38pm UTC](https://forum.kirupa.com/t/drag-and-drop/102203/3 "2004-02-20T21:38:05Z")

</div>

Hi Sharif

Thanks for your quick response…  
I am not quite sure what I am missing

I tried attaching my file, but I guess its too big  
164k… doesn’t seem too big to me.  
Anyway can I send it to your email so you can see what I  
am doing?

Thanks again for your help!!!
