I'm having problems suspending a drag and drop operation based on User input from an Alert prompt. i have a flex tree that acts as a drag initiator and a drop target as well (Dragging items of the tree within the tree itself) I'm trying to do a drag and then fire an alert prompt asking the user something like "Are you sure you want to move this item? Yes or No" when the item is dropped to a different location in the tree.
My first problem was that, the item is moved regardless of the outcome of the user's choice and i had to do an event.preventDefault() on the Drag drop handler to stop this from happening, After which i put my own custum logic saving the drag event to a variable to later redispatch it to complete the DnD process (Which seems rational).
My question is, Am I suspending the right type of event? How do i get something as simple as this working. After a while i started receiving this error "Error: Attempt to access a dead clipboard", is this a bug with the flex framework.
Any form of help will be very much appreciated, i also googled, stackoverflowed, and looked through every flex cookbook i know but no solution.
Please help me
I’m pretty sure Flex Drag and Drop is not designed for this scenario. I seem to recall other people struggling to do it in the past.
IIRC one problem is that there is an effect played to show the drop worked and suspending to ask a question causes that effect to play too soon, or not play at all. I think some folks wait for dragComplete if they know how to undo the drop, but the Alert shows on top of the tree with the object already dropped.
So are you saying this is almost impossible? Is there a way to somehow add the item to the tree's datapovider without showing a visual feedback in the tree. That is making the Tree UI not reflecting the newly added item after the drop, then showing the alert, getting the users input then doing a final clean up in the tree (by calling tree.invalidateList()//tree.validateNow()/or refreshDataProvider ) on dragComplete.
whats your opinion on this?