views:

66

answers:

1

Hi,

I am new to Flex, so please bear with me.

I have encountered a strange problem. There's a ActionScript class which dynamically creates basic UI element.

So I create RadioButton as

var rBtn:RadioButton = new RadioButton();

and then put it in a Panel Container.

The problem is that it appears to be a Button. However it behaves like RadioButton.

alt text

I have found this problem with one more guy who has posted it here. CheckBoxes and RadioButton looks like Push Buttons.

Please help me out with this.

Thanks.

+1  A: 

Hi,

Finally I figured what was going wrong here..

I was using flash.utils.getDefinitionByName() and also a MetaTag for my custom classes similar to [Frame(extaclass="com.test.wizardContainer")]

This meta Tag causes to have default style for any DisplayObject being created using getDefinitionByName().

CheckBox and Radio Button being sub-class of Button as DisplayObject. The style of Button is applied onto them. However they have their own behaviour.

I got rid of getDefinitionByName() and it was working fine.

For those who doesn't want to get rid of getDefinitionByName.Tou can simply do the following.

Say your custom class is classes.MyRadioButton, then

import classes.MyRadioButton;

public class someClass{
MyRadioButton;
...
...
...
}

I hope this helps who are facing similar problems.

Ravz