开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜