Flex 4 : How to automatically resize the button based on content?
I 开发者_如何学运维would like to automatically resize my button (spark button) according it content (label text)?
Anthony,
This should happen by default, if you don't explicitly define a width for the control.
Z
The button is automatically resized once you addChild(...) your Button.
Ok, I found a solution :-)
public class MyButton extends Button
{
public function MyButton()
{
super();
}
override protected function measure():void
{
super.measure();
this.width = this.measuredWidth;
}
}
Now, my button is always correctly resize (width).
Thanks everybody
Anthony
精彩评论