I agree with Steven, however if your HBox is
a child of the Canvas you can simply do:
<mx:HBox width="{this.width}"
/> and it should work.
For the labels:
<mx:HBox>
<mx:Label text="left"
/>
<mx:Spacer widthFlex="1"
/>
<mx:Label
text="center" />
<mx:Spacer widthFlex="1"
/>
<mx:Label
text="right" />
</mx:HBox>
Matt (who just got home and is going to
bed. I was not home all night reading e-mail. Really. I'm serious this
time.)
-----Original Message-----
From: Steven Webster
[mailto:[EMAIL PROTECTED]
Sent: Sunday, May 09, 2004 1:15 AM
To: [email protected]
Subject: Re: [flexcoders] Layout
Help
Josh,
Quick question -- does your canvas immediaely
contain your
hbox (and nothing else) ? Can't you make
your custom component
an HBox, and then set the widthFlex on your custom
component
at instantiation time, to ensure that it resizes ?
eg:
MyCustom.mxml
<mx:HBox ... >
... whatever
</mx:HBox>
And then in main.mxml
<mx:Application xmlns:josh="*"...
>
<josh:MyCustom
widthFlex="1" />
: : :
</mx:Application>
To ensure that "MyCustom" always resizes
to the width
of your application. I'm not sure what
you're gaining
by using Canvas, which requires that you set the
(x,y)
points on your children directly - the layout
manager
doesn't do much for you with a Canvas.
Best,
Steven
--
Steven Webster
Technical Director
iteration::two
On Sun, 2004-05-09 at 08:56, joshbronson630 wrote:
> I'm having some trouble figuring out the best
way to layout
> UIObjects. I'll provide a couple examples of
some things I'm trying
> to do.
>
>
> Say I have a Custom Component whose top-level
container is a Canvas.
> The Canvas contains an HBox that should
always fill the width of the
> Canvas, even if the user resizes it. If I
could give the Canvas an
> id attribute, say "myCanvas", and I
set the HBox's width
> to "{myCanvas.width}", would this dynamically
recalculate the width
> after the user resizes the Canvas, or would
it only calculate the
> width once when the HBox is initially drawn?
If dynamic resizing is
> possible, how can I achieve this if I cannot
give the Canvas an id
> attribute since it is the top-level
container?
>
>
> Say I have three labels in this HBox (whose
width changes
> dynamically), and I want the first label to
always be aligned left,
> the second aligned center, and the third
aligned right. What's the
> easiest way to do this?
>
>
> Thanks,
> Josh
>
>
>
>
> Yahoo! Groups Links
>
>
>
>