On my EA project I am using the jquery droppable function. Note that the code I have written works correctly, but is what I would call inefficient code, as you will see below. Can you advise of a way that I could write the droppable function(s) more efficiently?
There is 1 element on the stage that is draggable. Then I have 5 elements that are droppable. These five droppable elements are nested inside a child symbol .
On the stage I have a parent symbol named 'parentSymbol', nested inside that I have a child symbol named ‘childSymbol’, which contains various elements.
I do not want to make the entire childSymbol droppable, only some of the elements within this child symbol. Namely:
element1
element2
element3
In composition ready I have included the following droppable functions, which work correctly.
//droppable function for element1
sym.getSymbol('parentSymbol').getSymbol(‘childSymbol’).$(‘element1’).droppable({drop: function() {
//disable droppable
sym.getSymbol('parentSymbol').getSymbol(childSymbol’).$(‘element1’).droppable( 'disable' );
}
});
//droppable function for element2
sym.getSymbol('parentSymbol').getSymbol(‘childSymbol’).$(‘element2’).droppable({drop: function() {
//disable droppable
sym.getSymbol('parentSymbol').getSymbol(childSymbol’).$(‘element2’).droppable( 'disable' );
}
});
And again for the third element……