3 Replies Latest reply on Oct 12, 2010 9:36 PM by BhaskerChari

    tile list reverse order

    Seglespaan

      Hey,

       

      anyone know if its possible to reverse the order of a tile list?

       

      say I have an array

       

      array

       

      item 1

      item 2

      item 3

       

      /array

       

       

      I want to display item 3 at the top of my list and 1 at the bottom?

       

      Cheers

       

      Tim

        • 1. Re: tile list reverse order
          BhaskerChari Level 4

          Hi Seglespaan,

           

          Just try to reverse the dataprovider Array for your TileList.

           

          myArray.reverse();

           

           

          Thanks,

          Bhasker

          1 person found this helpful
          • 2. Re: tile list reverse order
            Seglespaan Level 1

            Sorry my bad,

             

            it's actually an arraycollection I've got,

             

            if i use the array collection as my dataprovider all is well (apart from the tiles being in the wrong order), however if I use either

             

            myArrayCollection.reverse()    or    myArrayCollection.source.reverse() as my data provider it doesn't load the tiles correctly.

             

            any ideas??

            • 3. Re: tile list reverse order
              BhaskerChari Level 4

              Hi Seglespaan,

               

              I think  myArrayCollection.source.reverse(); should work for you..

               

              Check out this simple example below...

               

              <?xml version="1.0"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                 initialize="initData();" >
                 <mx:Script>
                 <![CDATA[
                    import mx.controls.Button;
                    import mx.collections.*;
                   
                    private var listArray:Array=[
                       {label: "item0", data: 0},{label: "item1", data: 1},
                       {label: "item2", data: 2},{label: "item3", data: 3},
                       {label: "item4", data: 4},{label: "item5", data: 5},
                       {label: "item6", data: 6},{label: "item7", data: 7},
                       {label: "item8", data: 8}];
                    [Bindable]
                    public var TileListdp:ArrayCollection;
                   
                    private function initData():void {
                       TileListdp = new ArrayCollection(listArray);
                       TileListdp.source.reverse();
                    }
                   
                 ]]>
                 </mx:Script>

                 <mx:TileList dataProvider="{TileListdp}"
                    itemRenderer="mx.controls.Button"/>
              </mx:Application>

               

               

              Thanks,

              Bhasker