【问题标题】:Manually scrolling through list手动滚动列表
【发布时间】:2013-05-22 09:06:19
【问题描述】:

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

这是我现在拥有的:

        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;
                }
            }
        }

这个滚动条就像一个护身符一样在物品中滚动,但是如果有一个垂直滚动条,那么那个滚动条就不会滚动。我如何使那个滚动条滚动?

【问题讨论】:

  • 女巫名单课?来自 Flex(MX 包)?从火花?第三方库?
  • sparks,但我已经解决了

标签: flash apache-flex list flash-builder


【解决方案1】:

哈哈,没关系,我刚刚找到了解决方案,只需使用 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);
        }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-12
    相关资源
    最近更新 更多