1 Reply Latest reply on Jul 1, 2009 7:23 AM by chris.huston.t10

    Images from URL in TileList, from Actionscript


      This seems like it should be simple (and I've searched around lots), but no image is displayed, and no error is given:


      in the App I have:

      <mx:TileList id="friendstlist"></mx:TileList>


      and then in some code:

      var friendsarr:Array = new Array();
      friendsarr[0] = {label:"name", source: "http://farm3.static.flickr.com/2468/3538077022_056014e0bd.jpg"};
      friendstlist.dataProvider = friendsarr;


      The name displays fine, but no sign of an image : (


      Thanks for any help!

        • 1. Re: Images from URL in TileList, from Actionscript
          chris.huston.t10 Level 3

          You need to use an itemRenderer to display your image and image name in the tile list. Here is one example:


          <?xml version="1.0" encoding="utf-8"?>
          <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" fontSize="12" height="180" width="210"
              horizontalScrollPolicy="off" verticalScrollPolicy="off" horizontalAlign="center" >

                  [Bindable] public var src:String;
                  [Bindable] public var media_label:String;

                      override public function set data(value:Object):void {
                          if(value != null)  {
                              super.data = value;

                              this.toolTip = data.media_size + 'Kb\r' + data.media_date;
                              media_label = data.media_name;

                              src = data.media_source;

              <mx:Image id="img" source="{src}"
                  maxWidth="200" maxHeight="150"/>
              <mx:Label text="{media_label}" maxWidth="200"/>


          This example assumes that the tileList has an ArrayCollection as a dataProvider with each object having media_size, media_date, media_name, and media_source properties.



          1 person found this helpful