Flex2中,所有的可视化组件都实现了可拖拽的功能,有部分组件在此基础上进行了扩展。简单应用就可以做出很有趣的效果。
这部分组件包括:List,DataGrid,Menu,TileList,Tree
以下代码就实现了List组件间数据的相互拖拽效果:
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
width="365" height="225"
creationComplete="creationCompleteHandler();"
>
<mx:Script>
<![CDATA[
private function creationCompleteHandler():void
{
srclist.dataProvider = ["Flex", "Flash", "Red5"];
destlist.dataProvider = [];
}
]]>
</mx:Script>
<mx:Panel title="Select activities" layout="horizontal">
<mx:VBox width="50%">
<mx:Label text="List 1"/>
<mx:List
id="srclist" width="100%" height="100"
allowMultipleSelection="true"
dragEnabled="true"
dropEnabled="true"
/>
</mx:VBox>
<mx:VBox width="50%">
<mx:Label text="List 2"/>
<mx:List
id="destlist" width="100%" height="100"
dropEnabled="true"
dragEnabled="true"
/>
</mx:VBox>
</mx:Panel>
</mx:Application>
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}