0

在实现手动拖放功能时,我正在尝试将火花列表 ItemRenderer 添加为 DragInitiator。下面的示例将整个列表作为一个 dragInitiator。问题是在这种情况下如何使用 Itemrenderer?

protected function myList_dragStartHandler(event:DragEvent):void
{
    var dragInitiator:List = event.currentTarget as List;
    var selectedQuery:Object = List(event.dragInitiator).selectedItem;
    var ds:DragSource = new DragSource();
    ds.addData(selectedQuery, "query");
    DragManager.doDrag(dragInitiator, ds, event);
}

<s:List id="myList" y="10" height="273" dataProvider="{sqList}" labelField="desc" itemRenderer="SqItemRenderer"
    dragEnabled="true" dragStart="myList_dragStartHandler(event)"/>
4

1 回答 1

0

解决了为我的 itemrenderer 设置 mouseMove 处理程序的问题。

override public function set data(value:Object):void
{
     if (value != null)
     {
        super.data = value; 
     }
}

protected function itemrenderer1_mouseMoveHandler(event:MouseEvent):void
{
    var dragInitiator:IUIComponent = event.currentTarget as IUIComponent;
    var ds:DragSource = new DragSource();
    ds.addData(this.data, "foo");
    DragManager.doDrag(dragInitiator, ds, event);
}
于 2012-06-14T07:10:52.303 回答