# Help with drag n drop

**URL:** <https://forum.kirupa.com/t/help-with-drag-n-drop/184419>\
**Category:** Uncategorized\
**Created:** [April 5, 2006, 12:31am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419 "2006-04-05T00:31:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brisa](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Brisa](https://forum.kirupa.com/u/Brisa)\
**Post date:** [April 5, 2006, 12:31am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/1 "2006-04-05T00:31:51Z")

</div>

I have this drag n drop that is refusing to work right. It does drag and drop, but doesn’t execute what I’m telling it to do when the submit btn is clicked.

I need it to either say “Congrats”, or say “try again and reset” or say “Sorry”.

I’m attaching the file stripped from graphics if anyone can help me…Please do!!!

Thanks

---

<div class="post-metadata">

**Author:** ![Macaroni\_Ted](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Macaroni\_Ted](https://forum.kirupa.com/u/Macaroni_Ted)\
**Post date:** [April 5, 2006, 3:30am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/2 "2006-04-05T03:30:36Z")

</div>

[AS]else if (firstTry) {  
for (var i =1;i\<=itemcount;i++) {  
var obj = eval(‘item’+i);  
obj.\_x = obj.start\_x;  
obj.\_y = obj.start\_y;  
}  
feedbackText = tryagainFeedback;  
firstTry = false;  
}[/AS]  
in the function checkAnswers() make sure the variable in the for loop has no capital letter in it. you a had written for (var i =1;i\<=itemCount;i++) {

---

<div class="post-metadata">

**Author:** ![Brisa](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Brisa](https://forum.kirupa.com/u/Brisa)\
**Post date:** [April 5, 2006, 6:05am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/3 "2006-04-05T06:05:33Z")

</div>

Thank you! I fixed that but for some reason it’s still giving me the spinning ball, i.e. an abort script mesg.

I’m doomed!

I’ve tried everything and the script abort msg doesn’t go away…☹

---

<div class="post-metadata">

**Author:** ![Brisa](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Brisa](https://forum.kirupa.com/u/Brisa)\
**Post date:** [April 5, 2006, 4:17pm UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/4 "2006-04-05T16:17:54Z")

</div>

The spinning ball went away. Now I just have to make the rest button to work…If you have any ideas, please let me know.

You helped me tremendously!!::thumb2:

---

<div class="post-metadata">

**Author:** ![Brisa](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Brisa](https://forum.kirupa.com/u/Brisa)\
**Post date:** [April 5, 2006, 10:38pm UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/5 "2006-04-05T22:38:25Z")

</div>

I have this to initialize my clips:

```auto
function initializeItem(obj) {
    obj.startx = obj._x;
    obj.starty = obj._y;
    obj.returnFlag = false;    
}

```

but If a code a button to reset the clips using:

```auto
resetBTN.onRelease = function{
obj.startx = obj._x;
    obj.starty = obj._y;
}

```

it doesn’t put them back where they were before they were dragged and dropped to the target clips.

Everything else is working fine, but I tried different combinations to reset the clips and nothing happens.

Any lights?? The file is still the one in the original post, with the correction marked by Macaroni ( thanks again!!)

Brisa

---

<div class="post-metadata">

**Author:** ![kritikal](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kritikal/32/1699_2.png) [@kritikal](https://forum.kirupa.com/u/kritikal)\
**Post date:** [April 5, 2006, 11:27pm UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/6 "2006-04-05T23:27:02Z")

</div>

I haven’t looked at your file but if you want your obj mc to go back to it’s initial \_x and \_y you have to do

```auto

resetBTN.onRelease = function{
obj._x = obj.startx;
obj._y = obj.starty;
}

```

---

<div class="post-metadata">

**Author:** ![Brisa](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Brisa](https://forum.kirupa.com/u/Brisa)\
**Post date:** [April 6, 2006, 12:07am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/7 "2006-04-06T00:07:33Z")

</div>

I tried that too and it didn’t work.

Still in search for help.

Thank you!!!

Bri

---

<div class="post-metadata">

**Author:** ![Macaroni\_Ted](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Macaroni\_Ted](https://forum.kirupa.com/u/Macaroni_Ted)\
**Post date:** [April 6, 2006, 2:39am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/8 "2006-04-06T02:39:00Z")

</div>

ok first ull need to make a loop and to make sure u return all the boxes return.  
and then reset all the variables u have used. so…

[AS]resetBTN.onRelease = function(){  
for (var i=1;i\<=itemcount;i++) {  
var obj = eval(‘item’+i);  
var tarObj = eval(‘targetClip’+i);  
tarObj.full = false;  
obj.\_x = obj.startx ;  
obj.\_y = obj.starty;

```
}
resetClip = false

```

}[/AS]  
i think that should work.

---

<div class="post-metadata">

**Author:** ![Macaroni\_Ted](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Macaroni\_Ted](https://forum.kirupa.com/u/Macaroni_Ted)\
**Post date:** [April 6, 2006, 3:07am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/9 "2006-04-06T03:07:19Z")

</div>

just had another look…and i ull need to change this “else if” statement.

[AS]  
else if (firstTry) {  
for (var i =1;i\<=itemcount;i++) {  
var obj = eval(‘item’+i);  
var tarObj = eval(‘targetClip’+i);  
tarObj.full = false;  
obj.\_x = obj.startx ;  
obj.\_y = obj.starty;  
}  
feedbackText = tryagainFeedback;  
firstTry = false;  
}  
[/AS]

---

<div class="post-metadata">

**Author:** ![Brisa](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Brisa](https://forum.kirupa.com/u/Brisa)\
**Post date:** [April 6, 2006, 6:10am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/10 "2006-04-06T06:10:23Z")

</div>

onegaishimasu.

Arigato  
Domo arigato  
Arigato gozaimasu  
Arigato gozaima\*\*\*\*a  
Dan san  
Ookini  
Ookini arigatou  
Kora doshi  
Ohkini  
Ookini  
Oshoshina  
Nihwee-deebiru

Obrigada  
Thank you  
Gracias  
Merci  
Danke

hmm…I hope I got one of them right!!:))(would you please let me know?)

Your first answer was what I was looking for and there’s not so many ways to thank someone that help me SO MUCH!!

Have a great day!! And thank you, again:))

---

<div class="post-metadata">

**Author:** ![Macaroni\_Ted](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@Macaroni\_Ted](https://forum.kirupa.com/u/Macaroni_Ted)\
**Post date:** [April 6, 2006, 6:18am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/11 "2006-04-06T06:18:06Z")

</div>

LOL your welcome  
dou itashima\*\*\*\*e!

onegaishimasu=please  
Arigato  
Domo arigato  
Arigato gozaimasu  
are all fine

Ookini is how people say thank you in and around Kyoto!

😉

edit:: it wont let me type S_H_I\*T as part of a word??

---

<div class="post-metadata">

**Author:** ![Brisa](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Brisa](https://forum.kirupa.com/u/Brisa)\
**Post date:** [April 6, 2006, 6:23am UTC](https://forum.kirupa.com/t/help-with-drag-n-drop/184419/12 "2006-04-06T06:23:13Z")

</div>

s_h_i_t_ happens…hehehe…

Thanks for the time, answers and Japanese lessons too…hehehehehhe

Brisa
