Search code examples
apache-flextilelist

Flex TileGrid: Why do you default to copying when I drag and drop your items?


Why is it that, when I enable dragging-and-dropping in a TitleGrid, items are copied when they are dragged instead of moved?

For example:

<mx:TileList dragEnabled="true" dropEnabled="true">
    <mx:dataProvider>
        <mx:Array>
            <mx:Object label="Nokia 6630"/>
            <mx:Object label="Nokia 6680"/>
        </mx:Array>
    </mx:dataProvider>
</mx:TileList>

When either of those items is clicked-and-dragged, it will get copied instead of moved.

This is especially confusing because TileList is a decedent of ListBase, which DataGrid also descends from... But DataGrid does the right thing when dragging and dropping items.


Solution

  • please test following code:

    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
    
        <mx:TileList dragEnabled="true" dragMoveEnabled="true" dropEnabled="true">
            <mx:dataProvider>
                <mx:Array>
                    <mx:Object label="Nokia 6630"/>
                    <mx:Object label="Nokia 6680"/>
                </mx:Array>
            </mx:dataProvider>
        </mx:TileList>
    
        <mx:TileList dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" />
    
    </mx:WindowedApplication>
    

    The solution of your problem is dragMoveEnabled="true". Hope that helps.