View Full Version : Trouble with list box & selectedIndex

06-23-2007, 08:09 PM
I have a list box component and the content of the list is dynamically loaded when a user selects a category. I am trying to get my list box to jump back to the top row when the content is loaded. If they have scrolled down the list and then change the category, the list remains in the same position.

BTW, Flash 8, AS 2.

I have been reading posts all over this forum and some are saying that myListBox.selectedIndex=0 will do the trick. Some users say that it works for them, others say it does not. I have also read that the selectedIndex property cannot be changed but when I change it and then check the value of the property, it has been changed to what I set it to.

So even though the index property does accept the change, the list and scroll bar stay put.

Is there a way to force the list to display the top of the list? Being that the content of the list box is freshly loaded when I wish to scroll back to the top, is there another way around it?

Thanks for your help on this.

06-26-2007, 01:49 AM
Well, I finally figured out a way to get the list box to reset back to the top. When the user changes the category of the list I have it going to a blank keyframe right before the keyframe containing the list box, hence removing the list box from the stage for one frame. When the list box returns on the next frame it is blank and needs to be reloaded but that's what I'm doing anyways so it works fine that way.

06-26-2007, 05:36 AM
Well, after finding one way around it, I finally found the right way.

myListBox.vPosition=0; :o