老外 的 下拉 树

老外 的 下拉 树

http://www.myflexiblelife.com/2009/07/22/how-to-combine-the-power-of-a-flex-tree-control-within-a-combobox/

<?xml version="1.0"?> 
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:wg="com.webgriffe.components.*" 
    creationComplete="loadXML()"> 
 
  <mx:Script> 
  <![CDATA[ 
      import mx.collections.XMLListCollection; 
      import mx.rpc.events.ResultEvent; 
      import mx.rpc.http.mxml.HTTPService; 
 
      public var xmlService:HTTPService = new HTTPService(); 
 
      [Bindable]
      public var xmlResult:XML;
 
      [Bindable] 
      public var xmlList:XMLList;
 
      [Bindable] 
      public var xmlTeams:XMLListCollection; 
 
    public function loadXML():void 
    { 
      xmlService.url = "mlb.xml"                 
      xmlService.resultFormat = "e4x"; 
      xmlService.addEventListener(ResultEvent.RESULT, resultHandler); 
      xmlService.send(); 
    } 
 
    public function resultHandler(event:ResultEvent):void 
      { 
         xmlResult = XML(event.result); 
         xmlList = xmlResult.league; 
         xmlTeams = new XMLListCollection(xmlList); 
      } 
  ]]> 
  </mx:Script> 
  <wg:TreeComboBox 
      width="200" treeHeight="250" 
      dataProvider="{xmlTeams}"
      labelField="@label" />
</mx:Application>

你可能感兴趣的:(xml,Flex,Adobe)