开发者

CheckBox gets converted to Button in Flex

开发者 https://www.devze.com 2023-01-01 07:11 出处:网络
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.

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 http://www.freeimagehosting.net/uploads/438cac93dd.png

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号