2010-06-26 29 views
8

我正在尝试做一个简单的CSS声明。但是,我收到了上述警告,不知道如何解决。我认为s |(type)应该为我声明样式。警告:组件'sparks.component.TextInput'中不支持CSS类型选择器

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

回答

25

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

你有两个选择:

  • 使用类选择,而不是
  • 移动类型选择申报是在你最MXML文件中声明
+2

Man..no书永远的CSS提到那!他们所说的是多么伟大的类型选择器,但从未提及它在组件中不受支持。我一直在寻找答案。我想我会按照你的建议。谢谢! – FlyingCat 2010-06-28 03:32:36

相关问题