Checking drag and drop

I have a game, where kids have drag some labels onto a map. There’s 9 labels, and 9 target areas.
Once all the labels are placed on a target area, a button should appear so that when they click on it, the computer can mark their answers.
Any correct labels stay in their place and turn green, any incorrect ones flip back to their original position, and you have another go.

The problem I’m having is getting the computer to recognise when all 9 labels are in place. So far, I’ve got the following code on each button inside each mc, that checks to see if the label is placed on a target. If it is, it’ll centre itself, if not it’ll go back to the side:

on (press) {
&nbsp &nbsp &nbsp &nbsp this.startDrag("", 0, 0, 740, 420);
on (release) {
&nbsp &nbsp &nbsp &nbsp this.stopdrag();
&nbsp &nbsp &nbsp &nbsp drop = this._droptarget;
&nbsp &nbsp &nbsp &nbsp if (drop == “/targete”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 357.4;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 220.9;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targetemid”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 320.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 180;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targethumber”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 315.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 137;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targetlondon”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 407.4;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 263;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targetne”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 278.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 80;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targetnw”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 186.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 142;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targetse”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 324.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 306;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targetsw”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 181.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 309;
&nbsp &nbsp &nbsp &nbsp } else if (drop == “/targetwmid”) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 186.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 219;
&nbsp &nbsp &nbsp &nbsp } else {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._x = 514.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this._y = 276.5;
&nbsp &nbsp &nbsp &nbsp }

What I want to do is add on some AS after this so that it’ll check whether all the labels are in a target, and if they are make the mark button mc visible. I’ve got a whole load of if statements, and they work in other areas of the movie, but when I put them after the above code, nothing happened.

Any ideas please???

  • Kit

I believe there are several ways to do this.

My first thought is: If you want the mc to be visible after all statements are true, and you know that you have 9 … you could increment the value of a variable with every correct answer… say score… that way…

on (release) {


    drop = this._droptarget;
    if (drop == "/targete") {

this._x = 357.4;
this._y = 220.9;
} else if (drop == “/targetemid”) {
this._x = 320.5;
this._y = 180;

so on and so forth… then at the end


trace(“you did it”);

of course, there are other ways, but this one should work out just fine.

Good luck!

Why didn’t I think of that? I was running the score++ bit a lot later…

Thanks mate!