Drag and drop

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

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:


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:

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!!!