2012-10-07 21 views

回答

1

您可以爲您的Spark TextInput創建自定義外觀。

它可能看起來像這樣(默認TextInputSkin副本):

<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:fb="http://ns.adobe.com/flashbuilder/2009" 
    alpha.disabledStates="0.5" blendMode="normal"> 

    <fx:Metadata> 
    <![CDATA[ 

     [HostComponent("spark.components.TextInput")] 
    ]]> 
    </fx:Metadata> 

    <fx:Script> 
     <![CDATA[ 
      ... 
     ]]> 
    </fx:Script> 

    <s:states> 
     <s:State name="normal"/> 
     <s:State name="disabled" stateGroups="disabledStates"/> 
     <s:State name="normalWithPrompt"/> 
     <s:State name="disabledWithPrompt" stateGroups="disabledStates"/> 
    </s:states> 

    <s:Rect left="0" right="0" top="0" bottom="0" id="border"> 
     <s:stroke>  
      <s:SolidColorStroke id="borderStroke" weight="1" /> 
     </s:stroke> 
    </s:Rect> 

    <s:Rect id="background" left="1" right="1" top="1" bottom="1"> 
     <s:fill> 
      <s:SolidColor id="bgFill" color="0xFFFFFF" /> 
     </s:fill> 
    </s:Rect> 

    <s:Rect left="1" top="1" right="1" height="1" id="shadow"> 
     <s:fill> 
      <s:SolidColor color="0x000000" alpha="0.12" /> 
     </s:fill> 
    </s:Rect> 

    <s:RichEditableText id="textDisplay" 
       verticalAlign="middle" 
       widthInChars="10" 
       left="1" right="1" top="1" bottom="1" /> 

    <s:Label id="promptDisplay" maxDisplayedLines="1" 
       verticalAlign="middle" 
       mouseEnabled="false" mouseChildren="false" 
       includeIn="normalWithPrompt,disabledWithPrompt" 
       includeInLayout="false" 
       /> 

那裏你可以看到一個名爲textDisplay形式的RichEditableText - 這是TextInput內的實際文本輸入字段。你可以按照你想要的方式來定位它。

+0

我還不是很熟悉火花組件,但看起來好像很容易調整! 非常感謝,這非常有幫助;) – user1727408