Variables, Drag and drop

Hi,

I working on a project, recreating an old flash app, and I need to drag and drop some images on some targets.Also I need to keep track of how many objects are dropped on targets in total, when they are drop on a target.

So I check out the example on using jquery to do the drag and drop, since drag and drop is on the " to do list" for Saola. It seems pretty straight forward.

How I do I know when an image is dropped on a target?
Also where would I place global variables ? Say Like var car_cnt = 0; ?
So when I drop an image on a target I’d add 1 to car_cnt.

Also is there a way to know what the image is (name) is when it dropped on a target ?

I’ve been using Saola for less than a year but haven’t gotten in to the coding side much , until now. Not sure how to do this in Saola.

Thanks.

Hi,

You can store global variables in doc object, just remember to add a prefix to prevent it from overwriting built-in doc properties. For example: doc.my_car_cnt = 0;
To know when an element is dropped into a target, you can use JqueryUI Droppable drop event.

For your convenience, please check this sample:
count-and-get-dropped-name.saolapack (2.9 KB)

Regards