Monday, July 7, 2008

Drag處理

感謝Hongyi大提供
http://www.brucephillips.name/blog/index.cfm/2006/11/4/Dragging-Items-From-a-TileList-Control-To-A-Container



說明如下
假設container所設處理drop的事件為
dragDrop="DropIn(event)"

public function DropIn(event:DragEvent):void
{
有兩個取資料的方式
dragInitiator---->指的是你從那個container拖拉出來的 指派到該container上
var sourceList:* =event.dragInitiator ;

dragSource---->指的是單位資料量 就像平常push到ac或xml的單一node
var items:Array = event.dragSource.dataForFormat("items") as Array;

trace(sourceList.selectedItem.ItfileName);
trace(items[0].ItfileName);

...以下略

No comments: