1 Reply Latest reply on Apr 28, 2008 8:36 AM by sandwicense

    Populate a TileList Component

    sandwicense Level 1
      I am building an image gallery and I want to populate a TileList Component with an xml file That is retrieved using ActionScript 3. The xml link is stored in a variable known as tileListASDP. How exactly do I use URLs as a component's data provider. Below is my code along with explanation.

      private var externalXML:XML;
      //When a user clicks a node in a tree component, the attribute @xmlLink is loaded from the XML file that populated //the tree (and this depends on which node is selected.)
      private function collectionSelect(event:Event):void {
      loadMyXML(event.currentTarget.selectedItem.@xmlLink + "");
      }


      private function loadMyXML(xmlname:String ) : void {
      var loader:URLLoader = new URLLoader();
      var request:URLRequest = new URLRequest(xmlname);
      loader.load(request);
      loader.addEventListener(Event.COMPLETE, onComplete);
      }
      [Bindable]
      public var tileListASDP:XMLList;
      public function onComplete(event:Event):void {
      navAccordion.selectedIndex = 2;
      var loader:URLLoader = URLLoader(event.target);
      externalXML = new XML(loader.data);
      tileListASDP = new XMLList(externalXML);
      }