Search code examples
actionscript-3flashbutton

AS3 - Changing size of Label on Button component


I would like to increase the size of the label on a Button in flash. The label seems to only be about 3/4 the width and 3/4 the height of the button. I would like to make the label be the full width and height of the button.

The label field is just a string, and changing the width/height on the textField property of the button does not seem to change anything. Also textFormat doesn't have options for changing text width/height.

I'm out of ideas. Any help would be greatly appreciated!


Solution

  • The only way I know is to do it via code.

            var myTextFormat:TextFormat = new TextFormat();
            myTextFormat.size = 20
            var myButton:Button = new Button();
            myButton.label = "Click Me";
            myButton.setStyle("textFormat", myTextFormat);
            myButton.setSize(120, 60);
            myButton.x = 0;
            myButton.y = 0;
            addChild(myButton);