1 Reply Latest reply on Dec 1, 2011 6:02 AM by Don Kerr

    SpinnerList Selecting Item

    Don Kerr Level 3

      How do you programmatically select an item in a SpinnerList?

       

      Setting selectedIndex is not working for me.

       

      dataProvider

      <s:ArrayCollection id="typesDP">

                                    <fx:Object l="map" v="map"/>

                                    <fx:Object l="photos" v="photos"/>

                                    <fx:Object l="pdf" v="pdf"/>

                                    <fx:Object l="video" v="video"/>

        </s:ArrayCollection>

       

      list

       

      <s:SpinnerListContainer  width="200"    >

                                                                            <s:SpinnerList id="type"  dataProvider="{typesDP}" wrapElements="true" labelField="l" change="type_changeHandler(event)" width="100%" height="100%"/>

        </s:SpinnerListContainer>

       

      set selectedindex doesn't work

       

      for (var i:Number = 0; i < typesDP.length; i++)

                                                                  {

                                                                            if(typesDP[i].v == data.type){

                                                                                      type.selectedIndex = i;

       

                                                                            }

                                                                  }

       

      It actually sets the index in variables debug view, but doesn't move the list to it.

       

      Any ideas?

       

      Thanks,

      Don