Is there a way to bind a Label's fontSize to be half the fontSize of another label?
I tried this:
<mx:Label id="mytitle" text="{title}" fontSize="{(mylabel.getStyle('fontSize') as Number)/2}"/>
No luck...anyone know a way?
Thanks
Is there a way to bind a Label's fontSize to be half the fontSize of another label?
I tried this:
<mx:Label id="mytitle" text="{title}" fontSize="{(mylabel.getStyle('fontSize') as Number)/2}"/>
No luck...anyone know a way?
Thanks
What you tried gets called too early, so the font for "mylabel" isn't initialized yet. You could use the initialize event to do this after the UI components are filled in.
<mx:Label id="mytitle" text="{halfSize}"
initialize="{setStyle('fontSize', mylabel.getStyle('fontSize') / 2)}"/>
Your chosen method won't work because getStyle isn't bindable. You could always bind both labels to some other value (one to it unmodified and one to that value divided by 2) and change that rather than the font size on the label itself.
The existence of a good solution might depend on why you want to do this though.