2012-01-11 65 views

回答

0

flex中的列表具有默認的拖放功能。因此,基本上所有您需要做的就是將3個屬性設置爲true以至您的列表: dragMoveEnabled,dragEnableddropEnabled。所以,你的清單,如果你從MXML添加它看起來就像這樣:

<s:List dataProvider="{yourDataProvider}" dragMoveEnabled="true" dragEnabled="true" dropEnabled="true" /> 

有關這些3個屬性,您可以檢查火花塞列表文檔的更多信息: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/List.html#dragMoveEnabled

0

感謝您的help.Now我趕上拖動itemRenderer時出錯(我的flex sdk是4.5.1)。 我的列表的itemRenderer:

<?xml version="1.0" encoding="utf-8"?> 
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx" 
      width="100%" height="100%"> 
    <fx:Script> 
    <![CDATA[ 
     import mx.events.CloseEvent; 


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

     protected function closeHandler(event:CloseEvent):void 
     { 
      //ToDo 
     } 

    ]]> 
</fx:Script> 
    <s:TitleWindow x="0" y="0" title="{data.label}" 
       width="100%" height="100%" creationPolicy="all" 
       skinClass="skin.titleWindowSkin" 
       close="closeHandler(event)"> 
    <s:Label text="{data.value}"/> 

    <s:TextInput x="123" y="58" text="@{data.value}" 
       focusIn="parentDocument.owner.dragEnabled=false" 
       focusOut="parentDocument.owner.dragEnabled=true"/> 

</s:TitleWindow> 
</s:ItemRenderer> 

雖然draging,趕上這樣的錯誤: 錯誤:皮膚的DragProxy261.ListItemDragProxy260.DspDesktopItemRenderer262._DspDesktopItemRenderer_TitleWindow1.titleWindowSkin264.Group265.contents._titleWindowSkin_Group5.contentGroup._DspDesktopItemRenderer_TextInput1無法找到。 at spark.components.supportClasses :: SkinnableComponent/attachSkin()[E:\ dev \ 4.5.1 \ frameworks \ projects \ spark \ src \ spark \ components \ supportClasses \ SkinnableComponent.as:698]