简体   繁体   English

如何使用CSS在flex中更改标签颜色?

[英]How to change Label color in flex Using CSS?

In my Flex Application i'm using Main.mxml sub.mxml 在我的Flex应用程序中,我正在使用Main.mxml sub.mxml

In Sub.mxml have code. 在Sub.mxml中有代码。

<mx:Label x="24" y="33" text="User ID"/>
<mx:Label x="24" y="59" text="Password"/>

And in my Main.Mxml file Writing CSS 并在我的Main.Mxml文件中编写CSS

mx|Label{
        fontFamily: Calibri;
        fontSize: 12;
        color: #000000;
    }

But Label not visiable ... is this Css wrong? 但是Label不可见...这是CSS错误吗?

The code seems ok. 该代码似乎还可以。 This simple example works: 这个简单的例子起作用:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
    <![CDATA[ import mx.events.FlexEvent; ]]>
</fx:Script>
<fx:Style>
    @namespace mx "library://ns.adobe.com/flex/mx";
    mx|Label {
        fontFamily: Calibri;
        fontSize: 12;
        color: #000000;
    }
</fx:Style>
<mx:VBox>
    <mx:Label text="asdasdasd">
    </mx:Label>
    <mx:Label text="sdas">
    </mx:Label>
</mx:VBox>
</s:Application>

Davide 戴维德

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM