import mx.core.BitmapAsset;
import mx.core.DragSource;
import mx.events.DragEvent;
import mx.managers.DragManager;
private function mouseDownHandler( evt:MouseEvent ):void
{
var initiator:Box = evt.currentTarget as Box;
var proxyBox:BitmapAsset = new BitmapAsset();
proxyBox.bitmapData = new BitmapData( initiator.width,initiator.height );
proxyBox.bitmapData.draw( initiator );
var dragSource:DragSource = new DragSource();
dragSource.addData( initiator, "box" );
DragManager.doDrag( initiator, dragSource, evt,proxyBox, 0, 0, 0.5 );
}
private function dragEnterHandler( evt:DragEvent ):void {
if( evt.dragSource.hasFormat("box")){
DragManager.acceptDragDrop( Canvas( evt.currentTarget ) );
}
}
private function dropHandler( evt:DragEvent ):void {
var box:Box = Box( evt.dragInitiator );
box.x = evt.localX ;
box.y = evt.localY ;
}