2

您可以通过在 CSS 中设置以下值来为 Flex 中的 RadioButton 设置外观:

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

但是,它仍会在您的皮肤内显示小圆圈图标。您可以通过设置以下样式来更改图标:

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

我的问题是,我怎样才能将这些图标设置为空?而不是 1x1 像素的透明图像之类的?我怎样才能给它一个空的样式?

编辑:

在 actionscript 我可以这样做:

button.setStyle("icon", null);

在 CSS 中我尝试过:

icon: none;
icon: null;

但都没有奏效。

接受的答案:

建议都有效,但我更喜欢更清洁的解决方案:

upIcon: ClassReference(null);

感谢您的两个答案(希望我可以将两者都标记为答案!)

4

3 回答 3

6

Try this:

ClassReference(null);
于 2009-01-12T05:26:07.540 回答
3

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.

于 2009-01-11T22:22:35.057 回答
1

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;
}
于 2009-01-11T20:49:51.967 回答