How to set the RadioButton icon style to nothing i

2019-07-17 08:10发布

You can skin a RadioButton in Flex by setting the following values in CSS:

upSkin: Embed(...); 
overSkin: Embed(...);
ownSkin: Embed(...);
disabledSkin: Embed(...);
selectedUpSkin: Embed(...);
selectedOverSkin: Embed(...);
selectedDownSkin: Embed(...);
selectedDisabledSkin: Embed(...);

But, it will still display the little circle icon inside your skin. You can change the icon by setting the following styles:

upIcon: Embed(...);
overIcon: Embed(...);
etc...

My question is, how can I set these icons to nothing? Rather than a 1x1 pixel transparent image or something? How can I give it an empty style?

Edit:

In actionscript I can do it like:

button.setStyle("icon", null);

In CSS I've tried:

icon: none;
icon: null;

But neither worked.

Accepted Answer:

Suggestions one & two both worked, but I prefer the cleaner solution of:

upIcon: ClassReference(null);

Thanks for both answers (wish I could mark both as the answer!)

3条回答
做自己的国王
2楼-- · 2019-07-17 08:26

Try this:

ClassReference(null);
查看更多
迷人小祖宗
3楼-- · 2019-07-17 08:28

If its standard CSS, you can use the following. I'm assuming the styles are classes, if they're IDs replace the . with a #:

.upSkin
{
    background: none;
}

The background property can be used to set color, positioning, and repeating; if you need to specifically target just the background image use:

.upSkin
{
    background-image: none;
}
查看更多
戒情不戒烟
4楼-- · 2019-07-17 08:37

I don't think it's possible to set the skin as null in Flex CSS. In fact, some Flex component must have something set for the skin, and they will throw runtime errors if you use setStyle("skinName", null). I usually use a declaration like this when I want no skin:

RadioButton
{
    upIcon: ClassReference("mx.skins.ProgrammaticSkin");
}

The ProgrammaticSkin class displays nothing and implements IFlexDisplayObject (which is often a requirement for skins in Flex), so I think it's the best choice for when you want a blank skin.

查看更多
登录 后发表回答