Hi,

I don't know where this is going but,

Really there is no issue here. He wanted width, he got width instantly with measuredWidth., end subject.

BTW

validateNow() instantly validates, no frame pass or anything.

layoutManager.validateClient(this);

This just seems to be a theoretical misunderstanding and somehow I think Flash is to blame. :)

The question truly becomes, why do you want to know the width 2 lines after you call addChild() when you didn't set it! The measuredWIdth property of the Text component IS the width until you explictly set the width property of the Text component.

This is why in component development, you call composite.getExplicitOrMeasuredWidth(). That method then wraps the decision to either get width or explicitWidth(if have been set by you) OR measured with if those are not set.

Peace, Mike

PS reread my last two posts, I say the same thing.


On 9/2/06, Muzak <[EMAIL PROTECTED] > wrote:

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: <flexcoders@yahoogroups.com>
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.
>
>




--
What goes up, does come down. __._,_.___

--
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
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to