Skip to main content
Participant
July 14, 2011
Question

HTML tags in radiobutton labels Please Help

  • July 14, 2011
  • 2 replies
  • 385 views

I have the following text string:

var myString:String = "This is <i>italic</i>.";

When displaying this in a dynamic text field using the following:

txtFieldOnStage.htmlText = myString;

The word "italic" is correctly showing as italic text.

However, I need the same result in a radio button component label that is already on the stage.

If I use the following code:

rb.label = myString;

The "<i>" and "</i>" show up in the label.

Is there a way to get the radiobutton and checkbox component labels to read the HTML code like the dynamic text fields do?

Thank you.

This topic has been closed for replies.

2 replies

Ned Murphy
Legend
July 14, 2011

I would just skip trying to make the label do anything and use a textfield in place of it... but then I've always had a dislike for some Flash components, particularly the radio buttons... I will normally construct my own as movieclips.

Participating Frequently
July 14, 2011

This is slightly convoluted, but could work:

radio buttons inherit a field called textField - it's the internal TextField that holds its label text.

textField has a property htmlText - which contains the HTML representation of the text field contents.

So if you had a radio button:

radioBtn.textField.htmlText = "This is <i>italic</i>.";

You might have some luck.