package org.selectionLists
{
import mx.controls.List;
import flash.events.Event;
import mx.events.DragEvent;
import mx.managers.DragManager;
public class CustomList extends List
{
private var _dragCopyEnabled:Boolean = false;
public function get dragCopyEnabled():Boolean {
return _dragCopyEnabled;
}
public function set dragCopyEnabled(value:Boolean):void {
_dragCopyEnabled = value;
}
override protected function dragDropHandler(event:DragEvent):void {
if (!_dragCopyEnabled) {
event.action = DragManager.MOVE;
DragManager.showFeedback(DragManager.MOVE);
}
super.dragDropHandler(event);
}
override protected function dragEnterHandler(event:DragEvent):void {
if (!_dragCopyEnabled) {
event.ctrlKey = false;
}
super.dragEnterHandler(event);
}
override protected function dragOverHandler(event:DragEvent):void {
if (!_dragCopyEnabled) {
event.ctrlKey = false;
}
super.dragOverHandler(event);
}
}
}
Wednesday, February 20, 2008
Custom List
List component doesn't allow to disable COPY action if Drag'n'Drop enabled. The following is a custom component that permit to disable COPY action:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment