2010-06-26 43 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