あなたがそれを試すまでは明らかではありません=)私はほんの数週間前に同じことで苦労しました. これが私の解決策でした:
リスト:
<List>
<mouseDown>onListMouseDown(event)</mouseDown>
</Tree>
マウス ダウン ハンドラー:
private function onMouseDown( event : MouseEvent ) : void {
var list : List = List(event.currentTarget);
// the data of the clicked row, change the name of the class to your own
var item : MyDataType = MyDataType(list.selectedItem);
var source : DragSource = new DragSource();
// MyAwsomeDragFormat is the key that you will retrieve the data by in the
// component that handles the drop
source.addData(item, "MyAwsomeDragFormat");
// this is the component that will be shown as the drag proxy image
var dragView : UIComponent = new Image();
// set the source of the image to a bigger version here
dragView.source = getABiggerImage(item);
// get hold of the renderer of the clicked row, to use as the drag initiator
var rowRenderer : UIComponent = UIComponent(list.indexToItemRenderer(list.selectedIndex));
DragManager.doDrag(
rowRenderer,
source,
event,
dragView
);
}
ユーザーがリスト内の項目をクリックすると、ドラッグが開始されます。dragEnabled
すべて自分で処理するため、リストにあるその他のドラッグ関連のプロパティは設定していないことに注意してください。
これをイベント ハンドラーの先頭に追加すると便利です。
if ( event.target is ScrollThumb || event.target is Button ) {
return;
}
ユーザーがスクロールバーのどこかをクリックした場合に短絡するだけです。あまりエレガントではありませんが、仕事はします。