How to set the RadioButton icon style to nothing in CSS (in Flex 3)?

守給你的承諾、 提交于 2019-12-11 03:48:00

问题


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!)


回答1:


Try this:

ClassReference(null);



回答2:


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.




回答3:


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;
}


来源:https://stackoverflow.com/questions/433654/how-to-set-the-radiobutton-icon-style-to-nothing-in-css-in-flex-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!