flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Farber (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEX-33660) ensureIndexIsVisible() does not work for spark.components.List
Date Sat, 10 Aug 2013 09:46:47 GMT
Alexander Farber created FLEX-33660:

             Summary: ensureIndexIsVisible() does not work for spark.components.List
                 Key: FLEX-33660
                 URL: https://issues.apache.org/jira/browse/FLEX-33660
             Project: Apache Flex
          Issue Type: Bug
          Components: Spark: List
    Affects Versions: Apache Flex 4.10.0
         Environment: Flex 4.10.0 and Flash Builder 4.7 on Windows 7
            Reporter: Alexander Farber
         Attachments: ScrollToBottom.mxml

The method ensureIndexIsVisible() does not really work when an item has been added to a List
and you have to use wrokarounds like the one described at the http://flexponential.com/2011/02/13/scrolling-to-the-bottom-of-a-spark-list/

I am attaching a very simple test case which demonstrates the failure (and the workaround)
for Flex 4.10.0:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			import spark.core.NavigationUnit;
			private function addMessage():void {
				// add the message
				// clear the text input
				message.text = "";
				// scroll to the bottom of the List to show this item
			private function scrollToBottomBuggy():void {
				chatList.ensureIndexIsVisible(chatList.dataProvider.length - 1);
			private function scrollToBottomWorkaround():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){
					delta = chatList.layout.getVerticalScrollPositionDelta(NavigationUnit.END);
					chatList.layout.verticalScrollPosition += delta;
					if (delta == 0)
	<s:Panel title="Chat" defaultButton="{btn}" horizontalCenter="0" verticalCenter="0" width="300">
		<s:List id="chatList" alternatingItemColors="[#EEEEEE,#DDDDDD]" height="120" width="100%">
				<s:VerticalLayout horizontalAlign="justify" gap="0" />
				<s:ArrayCollection id="dp" />
			<s:TextInput id="message" width="100%" />
			<s:Button id="btn" label="Send" click="addMessage()" />

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message