0

我需要使用箭头键手动处理滚动列表,而我成功处理了通过项目更改选择,如果列表大于其显示并且需要使用滚动条,则该滚动条不会使用所选滚动条物品。

这就是我现在所拥有的:

        function completionListUpDown(direction:Boolean):void{
            if(direction){
                if(popUp.completionList.dataProvider.length == (popUp.completionList.selectedIndex + 1)){
                    popUp.completionList.selectedIndex = 0;
                }
                else{
                    popUp.completionList.selectedIndex += 1;
                }

            }
            else{
                if(0 == popUp.completionList.selectedIndex){
                    popUp.completionList.selectedIndex = popUp.completionList.dataProvider.length - 1;
                }
                else{
                    popUp.completionList.selectedIndex -= 1;
                }
            }
        }

该滚动条像魅力一样通过项目滚动,但如果有垂直滚动条,则该滚动条将不会滚动。我如何使该滚动条滚动?

4

1 回答 1

0

大声笑,没关系,我刚刚找到了解决方案,只需使用 ensureIndexIsVisible(selectedIndex)

        function completionListUpDown(direction:Boolean):void{
            if(direction){
                if(popUp.completionList.dataProvider.length == (popUp.completionList.selectedIndex + 1)){
                    popUp.completionList.selectedIndex = 0;
                }
                else{
                    popUp.completionList.selectedIndex += 1;
                }

            }
            else{
                if(0 == popUp.completionList.selectedIndex){
                    popUp.completionList.selectedIndex = popUp.completionList.dataProvider.length - 1;
                }
                else{
                    popUp.completionList.selectedIndex -= 1;
                }
            }
            popUp.completionList.ensureIndexIsVisible(popUp.completionList.selectedIndex);
        }
于 2013-05-22T09:11:07.203 回答