Zesty
Zesty

Reputation: 3001

How do you scroll an mx:List by tabbing through items?

I'm sure someone must have accomplished this before, but I couldn't find any article on this.

How can we scroll a List control (with uses an itemrenderer) to the next item, when the user tabs from the current item to the next?

I know that we can use scrollToIndex(i), but how do we notify the List that the itemrenderer has moved to the next index? I couldn't find any such event.

Upvotes: 0

Views: 336

Answers (1)

J_A_X
J_A_X

Reputation: 12847

There are 2 ways that comes to mind.

1) You can research if it's possible to use tabIndex with item renderers (the default way for flash to do tabbing focus). I have never tried this myself, but it could be possible and would probably be the easiest way of doing it if you figure it out.

2) You could extend the List and add a Keyboard event listener that checks if the user pressed tab, and if so, do scrollToIndex(selectedIndex++) which would select the item renderer and scroll to it. Just need to make sure you don't go out of bounds with the selected index.

Upvotes: 1

Related Questions