R – Flex: How to drag the actual element rather than a proxy

apache-flexdrag and drop

I'm trying to implement a dragging system which can only be described as similar to dragging the map on Google Maps. I can set up dragging easily in Flex, but unfortunately the standard model of dragging i.e. dragging an element proxy and dropping it in another element is not what I'm after.

Is there anything built into flex where the actual element rather than a proxy can be repositioned in a different place within the same parent? Or will I have to hand code something using mouse events as you would if implementing a solution in JavaScript?

Cheers,

Chris

Best Answer

DragManager and its associated constructs are specifically for dragging and dropping. You will likely want to place your draggable item inside of a canvas with scroll policies turned off, and capture MOUSE_DOWN on the object, then activate MOUSE_MOVE, translating its origin analogous to the change in mouse position, deactivating the MOUSE_MOVE listener when MOUSE_UP or Event.MOUSE_LEAVE fires on the stage.