Flex4拖拽小例子

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
      creationComplete="application1_creationCompleteHandler(event)">
 <s:layout>
  <s:BasicLayout/>
 </s:layout>
 <fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 </fx:Declarations>
 <fx:Script>
  <![CDATA[
   import mx.collections.ArrayCollection;
   import mx.events.FlexEvent;
   

   protected function application1_creationCompleteHandler(event:FlexEvent):void
   {
    // TODO Auto-generated method stub
    leftList.dataProvider=new ArrayCollection(new Array('aa','bb','cc','dd','ff'));
    rightList.dataProvider=new ArrayCollection(new Array());
   }

  ]]>
 </fx:Script>
 <s:Panel width="500" height="500" title="拖拽实例" x="20" y="20">
  <s:HGroup>
   <s:VGroup>
    <mx:Label text="左列表"/>
    <mx:List id="leftList" width="200" height="350" allowMultipleSelection="true"
       dragEnabled="true" dropEnabled="true" dragMoveEnabled="true"/>
   </s:VGroup>
   <s:VGroup>
    <mx:Label text="右列表"/>
    <mx:List id="rightList" width="200" height="350" allowMultipleSelection="true"
           dragEnabled="true" dropEnabled="true" dragMoveEnabled="true"/>
   </s:VGroup>
  </s:HGroup>
 </s:Panel>
</s:Application>

你可能感兴趣的:(布局,flex4,拖拽)