How to properly set button phase after dragging over button?

Posted by irobeth on Stack Overflow See other posts from Stack Overflow or by irobeth
Published on 2010-05-11T20:42:13Z Indexed on 2010/05/11 20:44 UTC
Read the original article Hit count: 253

Filed under:
|

I have a class (mxml) that extends Button while implementing drag/drop support.

When I drag one of them onto another, the drag receiver stays stuck in its 'over' phase until I click on it (As if something about DragManager.acceptDragDrop is preventing the MouseEvent from getting to button)

Is there a way to make a button re-evaluate its phase after the drop? I've tried fabricating a MouseEvent and sending it to rollOverHandler with no luck.

This resembles the scenario in Button.as (lines 2606-2647) described like

    Drag over and up
        mouse down while out of Button
        roll over Button -> stay in "up" phase
        mouse up while over Button -> "over" phase
        continue with step 2 of first three sequences above

This is my drag/drop handler

private function dragDropHandler(event:DragEvent):void {
    trace("dropped");
    var ib : IconButton = (event.dragInitiator as IconButton);      
    if(this.data is Section) {
        if(ib.data is Item) {
            trace("ITEM");
            //move an item into a section.

            var ae : AldonaEvent = new AldonaEvent(AldonaEvent.MOVE);
            ae.data = ib.data;
            dispatchEvent(ae);

        } else if(ib.data is Section) {                 
            trace("SECTION");
            //change a section's parent.
            var ae : AldonaEvent = new AldonaEvent(AldonaEvent.MOVE);
            ae.data = ib.data;
            dispatchEvent(ae);

        }
    } //you can only drag stuff into sections.

}

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript-3