<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Flex: Making Scrollbars Follow Focus</title>
	<atom:link href="http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/</link>
	<description>Web Application Engineers</description>
	<lastBuildDate>Mon, 05 Dec 2011 17:24:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Container AutoScroll bei Focus &#124; michiweber</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-45810</link>
		<dc:creator>Container AutoScroll bei Focus &#124; michiweber</dc:creator>
		<pubDate>Fri, 22 Jul 2011 13:47:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-45810</guid>
		<description>[...] Original Script stammt von webapper und ist samt Beispiel hier (http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/) zum [...]</description>
		<content:encoded><![CDATA[<p>[...] Original Script stammt von webapper und ist samt Beispiel hier (<a href="http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/" rel="nofollow">http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/</a>) zum [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-40381</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Tue, 26 Apr 2011 07:35:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-40381</guid>
		<description>Very nice... modicifed it for spark scroller component - code below...

	public class AutoScroll
	{
        // this method is specifically written for the Scroller component
        // to use this on other scroller components will need modification or
        // another method
		public static function autoScroll(event:FocusEvent):void 
        {
			var scroller : Scroller = event.currentTarget as Scroller;
			var focusItem : DisplayObject = DisplayObject(scroller.focusManager.getFocus());
	
			// if no scrollbar or focused item, nothing to do
			if(scroller.verticalScrollBar &amp;&amp; focusItem) 
            {
    			// is the current focus item inside our container?
				if( focusItem == scroller &#124;&#124; !scroller.contains(focusItem) ) 
                {
					return;
				}
				
				// find the focusItem&#039;s y coord in the scrolled container 
				//  by summing the y offsets of the item and all parent containers in the tree
				//  between the target and the scrolled container
				var focusTopEdge : int = focusItem.y;
				var thisItem : DisplayObjectContainer = focusItem.parent;
                
				while(thisItem != scroller) 
                {
					focusTopEdge += thisItem.y;
					thisItem = thisItem.parent;
				}
                
				var focusBottomEdge : int = focusTopEdge + focusItem.height;
				var scrollbarRange : int = scroller.verticalScrollBar.maxHeight;
				var visibleWindowHeight : int = scroller.height;
				var lastVisibleY:int = visibleWindowHeight + scroller.viewport.verticalScrollPosition;

                if(scroller.horizontalScrollBar) 
                {
					// remove the horiz scrollbar height from lastVisibleY
					lastVisibleY -= scroller.horizontalScrollBar.height;
				}
				
				if( focusTopEdge == scroller.viewport.verticalScrollPosition ) 
                {
					//trace( &quot;Bar not moved, already at top edge of focus item.&quot; );
				}
				else if( focusTopEdge  0 ) 
                {
					var newPos : int = Math.min(scrollbarRange, scroller.viewport.verticalScrollPosition + (focusBottomEdge-lastVisibleY));
					scroller.viewport.verticalScrollPosition = newPos;
					//trace( &quot;Moved bar down to &quot; + newPos );
				}
				else 
                {
					//trace( &quot;Bar not moved.&quot; );;
				}
			}
		}
	}</description>
		<content:encoded><![CDATA[<p>Very nice&#8230; modicifed it for spark scroller component &#8211; code below&#8230;</p>
<p>	public class AutoScroll<br />
	{<br />
        // this method is specifically written for the Scroller component<br />
        // to use this on other scroller components will need modification or<br />
        // another method<br />
		public static function autoScroll(event:FocusEvent):void<br />
        {<br />
			var scroller : Scroller = event.currentTarget as Scroller;<br />
			var focusItem : DisplayObject = DisplayObject(scroller.focusManager.getFocus());</p>
<p>			// if no scrollbar or focused item, nothing to do<br />
			if(scroller.verticalScrollBar &amp;&amp; focusItem)<br />
            {<br />
    			// is the current focus item inside our container?<br />
				if( focusItem == scroller || !scroller.contains(focusItem) )<br />
                {<br />
					return;<br />
				}</p>
<p>				// find the focusItem&#8217;s y coord in the scrolled container<br />
				//  by summing the y offsets of the item and all parent containers in the tree<br />
				//  between the target and the scrolled container<br />
				var focusTopEdge : int = focusItem.y;<br />
				var thisItem : DisplayObjectContainer = focusItem.parent;</p>
<p>				while(thisItem != scroller)<br />
                {<br />
					focusTopEdge += thisItem.y;<br />
					thisItem = thisItem.parent;<br />
				}</p>
<p>				var focusBottomEdge : int = focusTopEdge + focusItem.height;<br />
				var scrollbarRange : int = scroller.verticalScrollBar.maxHeight;<br />
				var visibleWindowHeight : int = scroller.height;<br />
				var lastVisibleY:int = visibleWindowHeight + scroller.viewport.verticalScrollPosition;</p>
<p>                if(scroller.horizontalScrollBar)<br />
                {<br />
					// remove the horiz scrollbar height from lastVisibleY<br />
					lastVisibleY -= scroller.horizontalScrollBar.height;<br />
				}</p>
<p>				if( focusTopEdge == scroller.viewport.verticalScrollPosition )<br />
                {<br />
					//trace( &#8220;Bar not moved, already at top edge of focus item.&#8221; );<br />
				}<br />
				else if( focusTopEdge  0 )<br />
                {<br />
					var newPos : int = Math.min(scrollbarRange, scroller.viewport.verticalScrollPosition + (focusBottomEdge-lastVisibleY));<br />
					scroller.viewport.verticalScrollPosition = newPos;<br />
					//trace( &#8220;Moved bar down to &#8221; + newPos );<br />
				}<br />
				else<br />
                {<br />
					//trace( &#8220;Bar not moved.&#8221; );;<br />
				}<br />
			}<br />
		}<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: any</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-13053</link>
		<dc:creator>any</dc:creator>
		<pubDate>Thu, 29 Oct 2009 21:17:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-13053</guid>
		<description>Thanks! It works really fine!
I was looking for something similar but instead of using tab key, use Page-Up and Page-Down key, it&#039;s seems to be a little more complicated, isn&#039;t it?</description>
		<content:encoded><![CDATA[<p>Thanks! It works really fine!<br />
I was looking for something similar but instead of using tab key, use Page-Up and Page-Down key, it&#8217;s seems to be a little more complicated, isn&#8217;t it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zsagia</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-5060</link>
		<dc:creator>Zsagia</dc:creator>
		<pubDate>Sun, 14 Jun 2009 09:45:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-5060</guid>
		<description>Hi!

Thanks this code.</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>Thanks this code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeremy mooer</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-3424</link>
		<dc:creator>jeremy mooer</dc:creator>
		<pubDate>Mon, 18 May 2009 22:03:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-3424</guid>
		<description>Great post.  Thanks.
@radley -- I fixed the scrolling-up issue you were having:
http://techishdotjeremy.blogspot.com/2009/05/autoscrolling-flex-form.html</description>
		<content:encoded><![CDATA[<p>Great post.  Thanks.<br />
@radley &#8212; I fixed the scrolling-up issue you were having:<br />
<a href="http://techishdotjeremy.blogspot.com/2009/05/autoscrolling-flex-form.html" rel="nofollow">http://techishdotjeremy.blogspot.com/2009/05/autoscrolling-flex-form.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Avishay</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-670</link>
		<dc:creator>Avishay</dc:creator>
		<pubDate>Thu, 08 Jan 2009 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-670</guid>
		<description>Thanks, works graet on Flex3 as you said without the updateComplete.</description>
		<content:encoded><![CDATA[<p>Thanks, works graet on Flex3 as you said without the updateComplete.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: radley</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-669</link>
		<dc:creator>radley</dc:creator>
		<pubDate>Fri, 02 Jan 2009 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-669</guid>
		<description>it&#039;s close. but unfortunately it doesn&#039;t allow me to scroll back to the top. I can move the scrollbar to the top, but the display area doesn&#039;t change, so it looks like I&#039;m at the top when I&#039;m really not.</description>
		<content:encoded><![CDATA[<p>it&#8217;s close. but unfortunately it doesn&#8217;t allow me to scroll back to the top. I can move the scrollbar to the top, but the display area doesn&#8217;t change, so it looks like I&#8217;m at the top when I&#8217;m really not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-668</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 25 Nov 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-668</guid>
		<description>works great, thanks for making it</description>
		<content:encoded><![CDATA[<p>works great, thanks for making it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kishore kumar Unnikrishnan</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-667</link>
		<dc:creator>Kishore kumar Unnikrishnan</dc:creator>
		<pubDate>Fri, 24 Oct 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-667</guid>
		<description>Thanks Daryl, It really works fine, it matches exactly as per my requirement.</description>
		<content:encoded><![CDATA[<p>Thanks Daryl, It really works fine, it matches exactly as per my requirement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daryl Banttari</title>
		<link>http://www.webapper.com/blog/index.php/2008/02/01/flex-making-scrollbars-follow-focus/comment-page-1/#comment-665</link>
		<dc:creator>Daryl Banttari</dc:creator>
		<pubDate>Thu, 21 Aug 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2008/6/30/Flex-Making-Scrollbars-Follow-Focus#comment-665</guid>
		<description>Still works fine for me.  As I tab from field to field, the scrollbar adjusts to ensure the field with focus is in view.

What were you expecting?</description>
		<content:encoded><![CDATA[<p>Still works fine for me.  As I tab from field to field, the scrollbar adjusts to ensure the field with focus is in view.</p>
<p>What were you expecting?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

