Drag and drop function

I am trying to create a drag and drop action. I got it done, you can see it at

http://www.gwana.net/clients/merck2/slide16.swf

However, what needs to happen, is rather than counting each element when correctly placed, I need to set it up so that the user will drag and drop all of the elements, then press a submit button, which will then let the user know if they were all correct. If incorrect sort, then it will give a wrong answer animation then reset itself. Does anybody know how to do this?

Thanks.

Well, I guess that there’s some sort of loop that determines how many items are placed correctly, so all you need to do is create a button that launches the same processing.

submit.onPress = function () {
  // do whatever you do in your loop
} ;

This is the script used in one of the dragged objects:

on (press) {
startDrag("/description");
}
on (release, releaseOutside) {
stopDrag();
if (getProperty("/description", _droptarget) eq “_level4/description_mask”) {
/resultform:result = Number(/resultform:result)+1;
setProperty("/description", _name, “descriptionlock”);
}
if (Number(/resultform:result) == 8) {
tellTarget ("/") {
gotoAndPlay(“reward”);
}
}
}

Notice the “if (Number(/resultform:result) == 8)” statement. This is where it is counting the the correct objects. There are to be 8 of them. I’m not that great when it comes to scripting, and need some clarity. I placed a button on stage and added the script you provided, but nothing happened, the objects weren’t snapping onto target.

You can download the .fla at http://www.gwana.net/uploads/ to look at the code and how everything works?