警告:组件'sparks.component.TextInput'不支持CSS类型选择器。

8

我试图进行一个简单的CSS声明。然而,我收到了上面的警告,不确定如何解决它。我认为s |(type)应该为我声明样式。

<fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";
        @namespace mx "library://ns.adobe.com/flex/mx";

        s|TextInput{
        color:#313131;
        }           
</fx:Style>

<s:Panel width="600" height="480" skinClass="skins.CustomPanel">
    <s:layout>
        <s:VerticalLayout paddingTop="7"/>
    </s:layout>
    <s:TextInput text="TextInput CSS not working"/>
    <mx:Form>
        <mx:FormHeading label="Please Enter The Information"/>
        <s:HGroup>
            <mx:FormItem>
                <s:Label text="Brand"/>
                <s:TextInput id="brand" text="CSS not working" width="156"/>
            </mx:FormItem>
    </mx:form>
1个回答

25

CSS类型选择器不允许在组件定义中使用。

你有两个选择:

  • 使用类选择器代替。
  • 将类型选择器声明移动到在顶部MXML文件中声明的CSS中。

2
哎呀,没有一本书提到这点啊!他们只说如何伟大的类型选择器,却从不提及它在组件中无法支持。我已经寻找答案有一段时间了。看来我会遵循你的建议。谢谢! - FlyingCat

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接