Friday, October 1, 2010

Using the RadioButton component: Part 3

Today we will customize the looks of our RadioButton component.

You can change the position of the label related to the radio button itself using the labelPlacement property. The possible values are left, right, top and bottom. This can be set through the component inspector, or dynamically, using AS3:

rb.labelPlacement = "left";

You can modify the text field's appearance. First of all create a TextFormat object:

var myformat:TextFormat = new TextFormat(); 
myformat.color = 0xFF0000; 
myformat.font = "Courier New"; 
myformat.size = 18; 

Now apply it to the component using setStyle() method, where first parameter is the name of the style element you want to change and the second is the value.

rb.setStyle("textFormat", myformat); 

Here's what you can get:


You can draw your radio button the way you like it, too. Simply select it from the library and then the element you wish to edit.



Here's an example:


Thanks for reading!

Related:

Using RadioButton component: Part 1
Using RadioButton component: Part 2

No comments:

Post a Comment