1 Reply Latest reply on Apr 11, 2008 3:26 AM by SujitG

    Problem with TileList

      I have written code where the user selects a directory and all the contents of the directory are displayed in a TileList. At least that is what I supposed it would do. The contents are displayed but in this fashion "[object File]". Changing the itemRenderer to mx.controls.Image of the list just gives me a blank image.What I am doing wrong? Any suggestions please? Also, I want the tilelist to display only the *.jpg files will I do the filtering in the Array?

      public var d:File;

      public function dir():void

      d = new File(null);
      d.browseForDirectory("Select Directory");
      d.addEventListener(Event.SELECT, dirSelect);


      public function dirSelect(event:Event):void

      d = event.target as File;
      var dirs:Array = d.getDirectoryListing();
      list.dataProvider = dirs;

        • 1. Re: Problem with TileList
          SujitG Level 2
          try creating a custom component, which extends Image component. Your custom component should be something similar to the one below. Use this custom component as an itemRendered for your TileList.

          You have to get the object of the type File and then retrieve the url from the url property and then set it as a source to the Image.
          Hope this helps.

          public override function set data(value:Object):void
          var fileObj:File = value as File;
          if(fileObj.extension == ".jpg")
          this.source = fileObj.url;