Formatting radio buttons

I am at very early stage of my learning but I like to throw myself in the deep end and see how I get on.

I followed your very useful tutorial on using radio buttons for a quiz and had no trouble getting it to work.  Now I want to format the text filed and button labels to something that will fit in better with a current project.  I can style radio buttons when I put them on the stage but when I try the same techniques in the .as files, I can not get it to work.

I've read through the Adobe help files and trawled the net for inspiration but all has come to nought.  Is it possible for you to expand your earlier tutorials to show how to style the various components used to make the quiz?

Many thanks in advance.

Formatting radio buttons - Solved

 Jody,

Thank for replying so promptly.  When I was checking the syntax before replying to you I found a post on another forum which had this code in:

import flash.text.TextFormat;

//Text Format for radio buttons
var txtFmt:TextFormat = new TextFormat();
txtFmt.font = "Arial";
txtFmt.blockIndent = 2;
txtFmt.color = 0x000000;
txtFmt.size = 16;
txtFmt.leading = 4;
 
And this line inserted in the code for creating the radio buttons:
rb.setStyle("textFormat", txtFmt);
 
Old age setting in, but I'm sure I tried this the first time to no avail.  It worked this time though, so I'm now happy that I can figure out how to format my radio button text and the text fields.
 
Regards
 
Bryn
Jody Hall's picture

Regarding styling components

mudlark,

If I remember my own tutorial correctly, I believe I demonstrated how to embed fonts and set the font. So I'm not sure if you are talking about fonts, or some other sort of styling. In any case, I could look at your file for you if you want.

The components are notoriously hard to style, and supposedly they've improved it lately, but it remains difficult to get them to look the way you want. A lot of people, I'm sure, give up and start writing their own little (reusable) controls. It's not that hard, and the radio buttons are one of the easiest. And the good news there is that since you wrote the thing, it's tremendously easy to make it look however you want.

Write to me using my site's contact form. I'll write you back and then you can send me your file.

Jody