使用 CSS 定义 Flex 4 皮肤
我正在尝试通过 CSS 定义我的 Flex 4 皮肤,但我的自定义皮肤不会显示。这是我正在做的事情:
在我的应用程序中,我导入我的CSS并在我的按钮中定义styleName:
<fx:Style source="styles.css"/>
<s:Button label="Button" styleName="circle"/>
这是我的CSS:
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
s|Button.circle
{
skinClass: ClassReference("skins.buttons.CircleButton");
}
我的理解是我的按钮应该通过CSS提供它的skinClass,但它无法工作。如果我像下面一样直接定义 SkinClass ,它就可以正常工作:
<s:Button label="Button" skinClass="skins.buttons.CircleButton"/>
任何帮助将不胜感激。
I am trying to define my Flex 4 Skins via CSS but I my custom skin will not display. Here is what I am doing:
In my application I import my css and define the styleName in my button:
<fx:Style source="styles.css"/>
<s:Button label="Button" styleName="circle"/>
Here is my CSS:
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
s|Button.circle
{
skinClass: ClassReference("skins.buttons.CircleButton");
}
My understanding is that my button should be supplied it's skinClass via the CSS but it fails to work. If I define the skinClass directly like below it works fine:
<s:Button label="Button" skinClass="skins.buttons.CircleButton"/>
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先确保您的 CSS 文件位于根应用程序文件下。其次,我会尝试在没有类型选择器的情况下执行CSS,因此只需执行
.circle
,而不是s|Button.circle
。编辑
您还可以尝试将样式放入与按钮相同的容器内的样式标签中,看看是否有效。您确定您的应用程序可以找到您的 style.css 吗?显示更多代码可能会有所帮助。
Make sure you have your CSS file under the root Application file first. Second, I would try to do the css without the type selector, so instead of
s|Button.circle
, just do.circle
.EDIT
You can also try putting the style in a Style tag within the same container as your button to see if that works. Are you sure your application can find your style.css? Showing more code might help the situation.
根据官方 Flex CSS 文档:
看起来选择器可能无法在 Gumbo 中工作......
Per the official Flex CSS documentation:
It looks like selectors may not be working in Gumbo...