List with multilined (word wrapping) item renderer - how to scroll to the bottom? With test case and screenshots

前端 未结 1 678
南方客
南方客 2021-01-29 04:00

In a Flex 4 web application I am trying to use a spark.components.List for a chat (for various reasons - it works well for me in a Flex mobile app already), but because I use an

相关标签:
1条回答
  • 2021-01-29 04:47

    Found the answer myself at the Flexponential blog Scrolling to the bottom of a spark List:

        public static function scrollToBottom(list:List):void {
            // update the verticalScrollPosition to the end of the List
            // virtual layout may require us to validate a few times
            var delta:Number = 0;
            var count:int = 0;
    
            while (count++ < 10) {
                list.validateNow();
                delta = list.layout.getVerticalScrollPositionDelta(NavigationUnit.END);
                list.layout.verticalScrollPosition += delta;
    
                if (delta == 0)
                    break;
            }
        }           
    
    0 讨论(0)
提交回复
热议问题