These were examples from someone else that I was trying to help, but that doesn't matter.

 

You're explanation is correct, except for one detail... when you say "including redrawing if need be". Calling validateNow() doesn't cause the player to redraw during the call, although it may cause the player to redraw later. The player always does delayed drawing that isn't in the middle of any ActionScript method.

 

What validateNow() DOES do is force the methods validateProperties(), validateSize(), and validateDisplayList() to be called immediately if they would be called later. The validateProperties() method calls commitProperties(), and a TextArea's commitProperties() method sets the 'text' into its internal TextField, which then causes maxVPosition to be correct.

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Mac Martine
Sent: Thursday, February 09, 2006 10:24 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex 2.0 beta TextArea question

 

 

If I understand you correctly, here’s the difference between your examples…

 

In your example where you set the vPosition from a Button:

 

private function setLogVPosition():void
{
      txtLog.vPosition = txtLog.maxVPosition;     
}

 

…the text in the text area was already set and fully drawn prior to setting the scroll position . All you are doing here is setting the vPosition on the text that is currently (and already) loaded into the textArea.. so there’s no problem.

 

In your other example, you were first changing the text of the textArea, and on the next line you set the vPosition. In this case, by the time you set the vPosition, the textArea had not fully updated with it’s new text.

So, by calling validateNow() in between changing the textArea contents and setting the vPosition, you are telling the textArea to perform any necessary property updates, including redrawing if need be. So then by the time you set the vPosition, the textArea is ready to go.

 

Let me know if that doesn’t clear things up.

 

-Mac

 

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
Sent: Thursday, February 09, 2006 6:37 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex 2.0 beta TextArea question

 

Sorry, I'm not following you. If you can be more explicit about what did
and didn't work (i.e., what's in the body of the function, and how you
call it), I can probably explain what's going on.

- Gordon


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
Behalf Of Jonas Windey
Sent: Thursday, February 09, 2006 1:26 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex 2.0 beta TextArea question

Thanks, validateNow() did the trick.

Still weird though that calling the same function from a button did the
event, but from code didn't work. Probably because all client-events
trigger
the validateNow() function automatically?

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
Behalf Of Gordon Smith
Sent: donderdag 9 februari 2006 8:29
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex 2.0 beta TextArea question

There should be no need for callLater() or a Timer. These are
workarounds from Flex 1.X that we want to banish in Flex 2.

Mac Martine wrote:
> I believe you will find a detailed answer in the thread
> from Feb 1 with > the Subject:
> [flexcoders] Scrolling a TextArea to the bottom?

This thread explained that setting a property like the 'text' of a
TextArea does not immediately update other properties such as
maxVPosition; by default this happens latter, for performance reasons.

However, you can force all properties to update immediately by calling
validateNow() on a UIComponent. So if you set the text, call
validateNow(), and then set the vPosition to the maxVPosition, it should
scroll to the bottom.

If there are problem with making this work, please file bugs.

- Gordon




-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
Behalf Of Manish Jethani
Sent: Wednesday, February 08, 2006 12:10 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Flex 2.0 beta TextArea question

On 2/8/06, Manish Jethani <[EMAIL PROTECTED]> wrote:

> Okay, the problem is that the TextArea's maxVPosition is 0 even after
> the text is set.  The new value of maxVPosition is calculated only on
> the next screen update.

..... and the solution for now is to use callLater() or a timer or
something.


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









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











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











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




Reply via email to