1 Reply Latest reply on Jul 1, 2009 11:13 PM by pyso

    How to scroll Tile

    pyso

      Hi all,

      I have Tile which thanks to Repeater help created and positioned myCustomComponents on the basis of Repeater.dataProvider Array. That's fine. Then next to Tile there is ComboBox which contains names of all myCustomComponents.

      User has possibility to choose any name from that ComboBox and Tile should after that scroll to this component if it's not visible. But I don't know how to find out y-position of selected component to be able set Tile.verticalScrollPosition.

       

      I was using TileList before and do this was pretty straightforward. Just call TileList.scrollToIndex(). But from some reasons I had to exchange TileList for Tile.

       

      Any idea how to find y-position of component inside Tile?

      Thanks,

      //pyso

        • 1. Re: How to scroll Tile
          pyso Level 1

          Hmm, it wasn't so dificult as I had thought.

          You have a reference to component myComp in Tile myTile.

          Then you call:

          var rect:Rectangle = myComponentgetBounds(myTile);

           

          and now you have y position of your component inside tile. So the only thing you need to do is count and set new y-position of myTile scrollbar:

          myTile.verticalScrollPosition = .....

           

          That's all.