If I could just say one more thing here, maybe it would clear up some confussion.

In Flash v2, Flex 1.5 you had _width.

_width was a property of the player that you could not override. Now in AS3, _width has changed to width and the meaning is still the same for DisplayObjects.

width is not the same for the flex framework. Now you can override width and that is what Adobe did, they overrode it and added wrapper proxies to it. They have implemented their own _width property but, that only stores the explicit width set by a client.

width in the flex frameowrk no longer means the actual player width of the DisplayObject now UIComponent. A UIComponent now delegates it's metrics to width, explicitWidth and measuredWidth.

This override and new rules are needed to create flexable layouts in the flex framework. Now, width just means 'the client set me to this and don't use me measuredWidth calculated in measure()'

This is a huge problem a lot of developers are dealing with when migrating from as2,Fash, Flex 1.5 to as3 flex framework(UIComponent).

So here again, width does not mean width as it pertains to a Sprite. Instead of the Flash player delegating a DisplayObject's dimensions, the flex framework overrides that responsibility.

This is also why anything that has to be added in a container(which all Flex apps are a part of ala Application is the root instance in a Flex2 app) has to implement IFlexDisplayObject.

The theory here is that IFlexDisplayObject then adds the needed measuredWidth, explicitWidth for a capable component to have itself perform the needed calculations for proper display in a Container, not Sprite.

I have written a lot about this and a huge book is coming on my web site talking about all this.

Peace, Mike


On 9/2/06, Michael Schmalle <[EMAIL PROTECTED]> wrote:
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.



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