[flexcoders] best general purpose way to keep textarea scrolled to bottom

2006-07-13 Thread Pan Troglodytes



I wish TextArea had a property that would set it to scroll to the bottom on adding text. In the absence of such, I'm struggling to make it do that. I have a log function that looks like this:
 private function log(s:Object):void { debug.text += \n + 
s.toString(); debug.verticalScrollPosition = debug.maxVerticalScrollPosition;
 }Unfortunately, it seems that the max position isn't updated yet at this point. I've tried hooking into change/dataChange and other events without luck. It's always scrolled ALMOST to the bottom.
What's the best way to solve this?-- Jason

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] best general purpose way to keep textarea scrolled to bottom

2006-07-13 Thread JesterXL





Use a callLater. I've used a doLater in the 
past and she worked pretty well. So like:

function log ( s )
{
 debug.text += s + 
"\n";
 callLater ( scrollIt 
);
}

function scrollIt()
{
 debug.verticalScrollPosition = 
debug.maxVerticalScrollPosition;
}

If that doesn't work, make scrollIt call itself 
recursively 1 time, via a counter. If that doesn't work, make it 2, 
etc. I promise it won't be over 10!





- Original Message - 
From: Pan 
Troglodytes 
To: flexcoders 
Sent: Thursday, July 13, 2006 12:23 PM
Subject: [flexcoders] best general purpose way to keep textarea 
scrolled to bottom
I wish TextArea had a property that would set it to scroll to the 
bottom on adding text. In the absence of such, I'm struggling to make it 
do that. I have a log function that looks like this: private function 
log(s:Object):void { debug.text += "\n" 
+ s.toString(); 
debug.verticalScrollPosition = debug.maxVerticalScrollPosition; }Unfortunately, 
it seems that the max position isn't updated yet at this point. I've tried 
hooking into change/dataChange and other events without luck. It's always 
scrolled ALMOST to the bottom. What's the best way to solve 
this?-- Jason  
__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] best general purpose way to keep textarea scrolled to bottom

2006-07-13 Thread Pan Troglodytes



I would have used callLater(), having only been hampered by not having ever heard of it.Thanks!On 7/13/06, JesterXL 
[EMAIL PROTECTED] wrote:












  






Use a callLater. I've used a doLater in the 
past and she worked pretty well. So like:

function log ( s )
{
 debug.text += s + 
\n;
 callLater ( scrollIt 
);
}

function scrollIt()
{
 debug.verticalScrollPosition = 
debug.maxVerticalScrollPosition;
}

If that doesn't work, make scrollIt call itself 
recursively 1 time, via a counter. If that doesn't work, make it 2, 
etc. I promise it won't be over 10!





- Original Message - 
From: 
Pan 
Troglodytes 
To: flexcoders 

Sent: Thursday, July 13, 2006 12:23 PM
Subject: [flexcoders] best general purpose way to keep textarea 
scrolled to bottom
I wish TextArea had a property that would set it to scroll to the 
bottom on adding text. In the absence of such, I'm struggling to make it 
do that. I have a log function that looks like this: private function 
log(s:Object):void { debug.text += \n 
+ s.toString(); 
debug.verticalScrollPosition = debug.maxVerticalScrollPosition; }
Unfortunately, 
it seems that the max position isn't updated yet at this point. I've tried 
hooking into change/dataChange and other events without luck. It's always 
scrolled ALMOST to the bottom. What's the best way to solve 
this?-- Jason  

  













-- Jason

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] best general purpose way to keep textarea scrolled to bottom

2006-07-13 Thread Darron J. Schall






I've done this in the past through code like the following:

textArea.addEventListener( FlexEvent.VALUE_COMMIT, autoScrollToBottom );

private function autoScrollToBottom( event:FlexEvent ):void
 {
  // Auto-scroll to the bottom anytime the text changes
  event.target.validateNow();
  event.target.verticalScrollPosition =
event.target.maxVerticalScrollPosition;
 }

Essentially, with the above code you never have to explicitly tell the
text area to scroll to the bottom - it will automatically do that
anything the text property changes programmatically. So, anytime you
assign the text to be something else, your scrollbar will automatically
adjust for you.

This is code I've used in the past with beta 3, and I haven't tried it
with the released version, so it's not guaranteed to work. :-)

-d

Pan Troglodytes wrote:


  
  I wish TextArea had a property that would set it to scroll to the
bottom on adding text. In the absence of such, I'm struggling to make
it do that. I have a log function that looks like this:
  
   private function
log(s:Object):void {
   debug.text +=
"\n" + s.toString();
  
debug.verticalScrollPosition = debug.maxVerticalScrollPosition;
   }
  
Unfortunately, it seems that the max position isn't updated yet at this
point. I've tried hooking into change/dataChange and other events
without luck. It's always scrolled ALMOST to the bottom.
  
  
What's the best way to solve this?
  
-- 
Jason
  
  




__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___




Re: [flexcoders] best general purpose way to keep textarea scrolled to bottom

2006-07-13 Thread Daniel Nelson



Maybe this old post will help 

See: 
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg19784.html

Hope it helps.
-Dan

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] best general purpose way to keep textarea scrolled to bottom

2006-07-13 Thread Pan Troglodytes



Very nice! Works fine for me in release.On 7/13/06, Darron J. Schall [EMAIL PROTECTED] wrote:













  







I've done this in the past through code like the following:

textArea.addEventListener( FlexEvent.VALUE_COMMIT, autoScrollToBottom );

private function autoScrollToBottom( event:FlexEvent ):void
 {
  // Auto-scroll to the bottom anytime the text changes
  event.target.validateNow();
  event.target.verticalScrollPosition =
event.target.maxVerticalScrollPosition;
 }

Essentially, with the above code you never have to explicitly tell the
text area to scroll to the bottom - it will automatically do that
anything the text property changes programmatically. So, anytime you
assign the text to be something else, your scrollbar will automatically
adjust for you.

This is code I've used in the past with beta 3, and I haven't tried it
with the released version, so it's not guaranteed to work. :-)

-d

Pan Troglodytes wrote:


  
  I wish TextArea had a property that would set it to scroll to the
bottom on adding text. In the absence of such, I'm struggling to make
it do that. I have a log function that looks like this:
  
   private function
log(s:Object):void {
   debug.text +=
\n + s.toString();
  
debug.verticalScrollPosition = debug.maxVerticalScrollPosition;
   }
  
Unfortunately, it seems that the max position isn't updated yet at this
point. I've tried hooking into change/dataChange and other events
without luck. It's always scrolled ALMOST to the bottom.
  
  
What's the best way to solve this?
  
-- 
Jason
  
  






  













-- Jason

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___