3 Replies Latest reply on May 15, 2012 4:01 PM by Flex harUI

    Setting focus on a list item


      I have a s:List set to a TileLayout for a gallery in a simple Media Manager. In the application you can edit the data of the image. Once you click update the update is sent to the database which triggers and list query to 'refresh' the view with the new updated images and their data, However, most our catalogs have 2000+ images and rather than sending the user back to the top of the page, I want to set the focus back on the image they had selected.


      At first I tried something simple like hold the selectedIndex and after the data reloaded the view, set the selectedIndex back to that image...simple enought, worked like a charm...however the list doesnt show the selected item since its low on the list. So if I scroll way back down the list, I see that image selected.. I need to set the focus on the selected item. So basically go back to the image that was selected initially. So if image 1000 is selected and has an index of 999, then move back to that image once the data reloads.


      My simple list:

      <s:List id="mediaList" width="100%" top="35" height="100%" dataProvider="{media}" click="populate();" itemRenderer="edu.umich.views.IR.NetworkImageIR"

                          allowMultipleSelection="true" >


                          <s:TileLayout horizontalAlign="center" verticalAlign="middle" />




      The item renderer is just a s:Image set to the location of our images.


      I thought I could use mediaList.focusManager.setFocus(but what goes here?)


      Oh BTW: This is an AIR desktop app.


      Thanks for any help you can offer!