Drag and Drop Subtract Value

May 07, 2019

Hey,

I am trying to build a drag and drop so that a user can drag an object to a target and it will be counted as "1". However, if the user decides to drag it to a different target, the "1" will be subtracted from the first target and added tot he second target. 

 

I can figure out how to add a "1" value when dragged on to a target, but I can't figure out how to subtract the value if it is removed from the target.

 

 

8 Replies
Walt Hamilton

Create a shape that is larger than the target, below it, filled, and transparent. Subtract 1 from Value when object is dragged over larger shape. Add two to Value when object is dropped on target.

If your targets are close enough together, and separated from the origin of the objects, you may be able to get one invisible shape to work for all the targets. If not, use one shape for each target.

If this isn't clear enough, attach the slide here, and I'll drop you a sample.

Lawrence Kenji Cautivo

Hi Shirley,

The solution presented by Rebecca on a previous thread may help you get around subtracting a value when an object is dragged from a target.

I've copied an excerpt from one of her responses below:

Instead of using a hot spot, I used a regular rectangular shape and sent it to the back. What you'd want to do is to make the shape transparent with no lines. I left it semi-transparent and left a line around it, just so you could see it and have a better sense of what I did.

I also added a T/F variable for each oval, similarly to what I did for Nick's question. So the triggers for each oval are like this, using Oval1 as the example:

Add 1 to the COUNT variable when Oval 1 is dropped on rectangle 1 (blue rectangle) if variable OVAL1 equals False

Set OVAL1 variable to true when Oval 1 is dropped on rectangle 1.

Subtract 1 to the COUNT variable when Oval 1 is dropped on rectangle 2 if variable OVAL1 is equal to true

Set OVAL1 variable to false when Oval 1 is dropped on rectangle 2

The goal is to track the count, but only add or subtract 1 time for each oval that is dragged.

Hope this helps.

Brian Samonek

Thanks so much!

 

It's still a bit... unclear, but probably because variables are a bit confusing to me. I've attached the slide here: I want to drag a package into a zip code (where it would get a "1" vlaue), but if you drag it off the zip code, the value would be subtracted. Of course, that's the part I can't figure out!

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