1 Reply Latest reply on Sep 19, 2006 2:04 AM by flexsam

    icons in the tile List

      hello all ,

      I am trying to display images in the Tilelist component whose path is given in the xml. The xml is located on the harddrive which is loaded in my mxml application as follows :

      import flash.events.*;
      import flash.net.URLLoader;
      import flash.net.URLLoaderDataFormat;
      import flash.net.URLRequest;

      public var myXML :XML;

      var XML_URL:String = "templateList.xml"
      var myXMLURL:URLRequest = new URLRequest(XML_URL);
      var myLoader:URLLoader = new URLLoader(myXMLURL);
      myLoader.addEventListener("complete", xmlLoaded);

      function xmlLoaded(evtObj:Event):void{
      myXML = XML(myLoader.data);

      I am using this myXML object as the dataProvider for tileList as follows :

      <mx:TileList id="ListOfTemplates" dataProvider="{myXML.template} " labelField="label" iconField="icon" >


      the strucutre of the xml templateList.xml is :

      <icon> sample1.jpg </icon>
      <icon> sample1.jpg </icon>

      Please help me.
      Thanks in advance
        • 1. Re: icons in the tile List
          flexsam Level 1
          Your image should be embeded. Something like this...

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="getXML.send()">

          import mx.controls.Alert;

          public var icon11:Class;

          public var icon12:Class;

          public var icon13:Class;

          <mx:HTTPService id="getXML" url="LabelsNIcons.xml" showBusyCursor="true" result="myTileList.dataProvider=event.result.root.template;" fault="Alert.show('Could not get Label and Icons!!!')" />
          <mx:TileList id="myTileList" />

          This HTTPService is getting a xml file LabelsNIcons.xml containing:
          <?xml version="1.0"?>

          Hope this helps