Flextras 是对的。最好的办法是展示您为尝试不同的事情并尝试自己解决问题所付出的努力。但是,我今天又心情很好,所以你去吧:)
主要应用:
import mx.collections.ArrayCollection;
[Bindable]
private var list1Array:ArrayCollection = new ArrayCollection([
{text: "a"},
{text: "b"},
{text: "c"},
{text: "d"},
{text: "e"}]);
[Bindable]
private var list2Array:ArrayCollection = new ArrayCollection();
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:HGroup>
<s:List dataProvider="{list1Array}" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" itemRenderer="listItemRenderer"/>
<s:List dataProvider="{list2Array}" dragEnabled="true" dragMoveEnabled="true" dropEnabled="true" itemRenderer="listItemRenderer"/>
</s:HGroup>
</s:Application>
列表项渲染器:
<?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"
autoDrawBackground="true">
<fx:Script>
<![CDATA[
private function updateData():void
{
data.text = textArea.text;
}
]]>
</fx:Script>
<s:HGroup>
<mx:Image width="50" height="50"/>
<s:TextArea id="textArea" text="{data.text}" change="updateData()"/>
</s:HGroup>
</s:ItemRenderer>