Drag-Drop interaction doesn't respond to shape-state?

May 22, 2012

Hello,

I am trying to set up an activity where users can drag shapes into boxes, and receive one of multiple feedbacks depending on how they do. The default drag-drop interaction seems to give one of three feedback screens, "correct", "incorrect", and "try again". I want to do the same but with an additional feedback that tells the user they're not done yet (if they haven't finished dragging all of the objects into boxes.) So, I made a button that the user can click to check their work, and that essentially does all that the native drag-drop interaction does.

This is what I've done so far - when the user clicks on the check-button, I want to check through each of the shapes to see whether they have already been dragged onto a box or if they're still sitting in the background (which is a large rectangle that fills the screen behind the boxes). The way that I originally wanted to do this was by looking at the state of each shape. If the shape-state is "normal", that means that it hasn't been moved yet. Also, I set it up so that whenever the shapes are moved onto the background, the state of the moved shape is again set to "normal". Currently, I have it set up so that each shape will change color to reflect its state (gray for normal, green for correct, red for incorrect). The colors are reflecting as I would expect (gray when on the background, green on the correct box, red for incorrect boxes). I also made a true-false variable to help me keep track of whether or not all the shapes have been moved to a box (called "allDone"). 

Here's where the problem is - even though the individual shapes' states are updating correctly as seen by the colors of each shape, I can't seem to use these states to update the "allDone" variable, and thus determine what feedback the user receives. I want to show the user the "you're not done" screen when one or more shapes haven't been placed onto a box, but this isn't working! However, when I rewrote all my code to avoid referencing state, and instead used true/false variables to manually measure whether or not a shape is placed onto a box, everything worked... but I thought that referencing a shape's state should do the same thing. Why isn't it doing that? 

I hope that I've explained my confusion clearly enough.. Can somebody please try to help me understand what is going on? Is this a problem in my code? Or is it something about state that I haven't grasped? Or is it a bug? 

I attached my files here - Drag_Drop_Booleans is the one where I rewrote my code with true-false variables. Drag_Drop_Original is the one where I tried to reference state... 

Thank you in advance, please let me know how I can be more clear. 

1 Reply

This discussion is closed. You can start a new discussion or contact Articulate Support.