I tested the code before, without the validateNow on the the text instance, so that wasn't bothering me.
When you call validateNow() on the application I guess you get the same result as with callLater() because validateNow() takes 'a frame' to execute, thus the code after that (the debug text) is delayed/executed later. Hope that makes sense.. I understand what you mean by things being different in Flex, but I think that's not really relevant here. The thing is that text properties do not have the 'correct' value immediatly when added to the display list through actionscript. regards, Muzak ----- Original Message ----- From: "Michael Schmalle" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, September 02, 2006 6:54 AM Subject: Re: [flexcoders] UIComponent.width is always 0 >> Nope, it doesn't. It returns 0. >> If you use callLater, all values are returned correctly. > > Hi, I didn't test the example and what I wrote is correct theory. ... now I > have. > > Really I have made some very complicated stuff with components and have > never had to use 'callLater()'. > > The problem is he is calling validateNow() on the text. > > change > > textViaAS.validateNow(); // really just for kicks, it doesn't > > to > > validateNow(); // really just for kicks, it doesn't > > and you will see the trace > > nulltextViaMXML.width = 255 > textViaMXML.measuredWidth = 255 > textViaMXML.textWidth = 97 > textViaAS.width = 306 > textViaAS.measuredWidth = 306 > textViaAS.textWidth = 97 > > This is becasue you are now calling validateNow() on the Application > component. > > Anyway, what he is doing is going against the grain. I don't think he fully > understands what 'width' is. In this case measuredWidth IS the width since > you didn't explictly call width. > > The ONLY reason width is even set in the 'callLater()' pass is becasue the > Application set the width in it's setActualSize() call ON the Text component > by USING the Text component's measuredWidth property. ;-) > > :) This takes a little mind bending to understand. width property doens not > always mean something. It depends on the contenxt metrics of the component's > state. > > Peace, Mike > > PS Everything is working the way it is supposed to, again, width is not > 'god' anymore. measuredWidth is. > > -- 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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

