1 Reply Latest reply on Feb 11, 2010 7:01 AM by yoav@cyteam.com

    Tile List Frustration

    bentwonk Level 1

      I am tring to create a simple tile list as part of an AS3 class, haveing looked at a few examples I do not seem to be able to populate it with data, neither addItem or dataPopulator seem to available to me, when using AS3 code.

      using the simplest exampe I could find, (http://www.adobe.com/devnet/flash/quickstart/tilelist_component_as3/)

      */

      import fl.controls.TileList;
      import fl.controls.ScrollBarDirection;

       

      /* // these had to be changed to imports below to compile

       

       

      import mx.controls.TileList;

       

      import mx.controls.scrollClasses.ScrollBarDirection;

       

       

      private function tilelist():void

       

      {

       

      // Create TileList instance

       

      var myTileList:TileList = new TileList();

       

       

      // Add four images to the TileList instance

       

      myTileList.addItem({label:"Montreal", source:"http://www.helpexamples.com/images/montreal/images/IMG_5057.jpg"});

       

      myTileList.addItem({label:"Swan", source:"http://www.helpexamples.com/flash/images/gallery1/images/pic11.jpg"});

       

      myTileList.addItem({label:"Sunset", source:"http://www.helpexamples.com/flash/images/gallery1/images/pic14.jpg"});

       

      myTileList.addItem({label:"Gate", source:"http://www.helpexamples.com/flash/images/gallery2/images/IMG_1592.jpg"});

       

       

      // Set scroll bar direction

       

      myTileList.direction = ScrollBarDirection.HORIZONTAL;

       

       

      // position TileList and set column and row values

       

      myTileList.move(0,0);

       

      myTileList.columnWidth = 200;

       

      myTileList.rowHeight = 140;

       

      myTileList.columnCount = 1;

       

      myTileList.rowCount = 2;

       

      myTileList.width = 200;

       

      myTileList.height = 295;

       

       

      // Add to the display (Stage)

       

      addChild(myTileList);

       

       

      }

       

       

      fails to compile as the addItem method cannot be found

       

       

      tried with a dataProvider, instead of add item, but that cannot be found either, and what is the include file for a dataProvider

       

       

       

      whats am I doing wrong, and why do adobe not cover this in their example?

       

      thanks in frustratuion .

        • 1. Re: Tile List Frustration
          yoav@cyteam.com Level 1

          You need to provide the dataProvider which is an ArrayCollection on which you do your addItem opertions:

          -----

           

          private var myItemCollection:ArrayCollection = new ArrayCollection();

           

          then in you code you assign it to your TileList.

           

          myTileList.dataProvider = myItemCollection;

           

          and you can then add your items ..

           

          myItemCollection.addItem( .........)