2010-08-02 60 views
1

我正在嘗試爲Flex 4 Spark Panel創建一個皮膚,該面板將在與面板頭部相匹配的面板的左側/右側創建邊框。基本上,一個銀色邊框一直圍繞面板的邊緣,類似於舊的Flex 3 mx:面板。我一整天都在試驗一個皮膚文件,並且無法獲得任何工作。有任何想法嗎?Flex 4面板邊框皮膚

回答

4

我把東西扔得真快。基於現有的PanelSkin創建一個皮膚。然後去找到id =「contentGroup」的組。將其更改爲如下所示:

 <s:Group width="100%" height="100%" minWidth="0" minHeight="0"> 
      <s:Line stroke="{wrapperStroke}" top="0" left="0" bottom="{0}" yFrom="0" yTo="{this.height}" xFrom="0" xTo="0"/> 
      <s:Line stroke="{wrapperStroke}" top="0" right="0" bottom="{0}" yFrom="0" yTo="{this.height}" xFrom="0" xTo="0"/> 
      <s:Group id="contentGroup"> 
      </s:Group> 
     </s:Group> 

然後,只需將contentGroup從邊緣移開,併爲筆畫指定顏色和重量。因此,頭在皮膚上的updateDisplayList,並添加像一些代碼:

 wrapperStroke.color = 0xD9D9D9; 
     wrapperStroke.alpha = 1.0; 
     wrapperStroke.caps = CapsStyle.SQUARE; 

     wrapperStroke.weight = 3; 
     contentGroup.top = 3; 
     contentGroup.bottom = 3; 
     contentGroup.left = 3; 
     contentGroup.right = 3; 

也只是把你wrapperStroke在聲明區,像這樣:

<fx:Declarations> 
    <s:SolidColorStroke id="wrapperStroke" /> 
</fx:Declarations> 

我硬編碼的一切,但你應該能夠輕鬆將它們作爲樣式。您的PanelSkin現在應該看起來像this。我增加了中風的重量,因此更容易看清。