tags:

views:

226

answers:

4

Hi everybody !

I would like to automaticaly resize my button (spark button) according it content (label text) ?

Thanks all for your help !

Anthony

A: 

Anthony,

This should happen by default, if you don't explicitly define a width for the control.

Z

Zaren
A: 

The button is automatically resized once you addChild(...) your Button.

Luis B
A: 

Dear all,

In my button skin, i specified width. So, my button is never automaticaly resized (with big or small label text inside) ...

So have you got some code examples to do this ?

Thanks a lot

Anthony

Anthony
A: 

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

Anthony