Flex中可以实现组件数据的拖拽:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
<mx:Style source="style.css" />
<mx:Script>
<![CDATA[
//初始化
internal function initApp():void{
var arr:Array = new Array();
//给数组添加元素
for(var i:Number = 0;i<6;i++){
arr.push("元素 "+i);
}
//list控件指定数据
list_1.dataProvider = arr;
list_2.dataProvider = arr;
//设置拖拽属性
list_1.dragEnabled = true;
list_1.dropEnabled = true;
list_1.allowMultipleSelection = true;
list_2.dropEnabled = true;
var str:String=new String("hello world");
trace(str);
}
]]>
</mx:Script>
<mx:Canvas styleName="box" x="45" y="65" width="420" height="360">
<mx:List id="list_1" x="26.5" y="40" height="284" width="160"></mx:List>
<mx:List id="list_2" x="229" y="40" height="284" width="160"></mx:List>
</mx:Canvas>
</mx:Application>
运行效果: