Search code examples
actionscript-3flashflash-cs6

AS3: change Font in Radio button


How can I change font used in Radio Button that existing in default components of flash professional?


Solution

  • To change the font of your RadioButton component label, you can use the RadioButton.setStyle() function to set the TextFormat which will be applied to the label (a TextField object) of the RadioButton component.

    For that, you can do like this for example :

    var text_format:TextFormat = new TextFormat();
        text_format.font = 'Verdana';
        text_format.color = 0xff0000;
    
    RadioButton(radio_button).setStyle('textFormat', text_format);
    

    you can also apply that directly to the label using the RadioButton.textField property which return the TextField object :

    RadioButton(radio_button).textField.setTextFormat(text_format);
    

    Hope that can help.