您想從操作欄中刪除的邊框, 屬於出現在actionGroup(actionContent)或navigationGroup(navigationContent)內部的Button。它由2個皮膚upBorderSkin和downBorderSkin控制(這些是spark.skins.assets.mobile包中的2個fxg文件)。 我在我的情況下做了刪除它,是我從upBorderSkin(spark.skins.assets.mobile.TransparentNavigation_up.fxg)複製源,並在包assets.mobile.BorderLessNavigationButtonSkin中創建了一個文件BorderLessNavigationButtonSkin。 代碼對於FXG是以下(有一個Rect隔板暗,顯示的垂直邊框,我只是設置alpha屬性爲0)
<?XML版本=「1.0」編碼=「UTF-8」?>
< Graphic version =「2.0」xmlns =「http://ns.adobe.com/fxg/2008」 scaleGridTop =「1」scaleGridBottom =「64」scaleGridLeft =「1」scaleGridRight =「79」>
<!-- highlight border right -->
<Rect x="79" y="1" width="1" height="63">
<fill>
<LinearGradient x="0" scaleX="63" rotation="90">
<GradientEntry color="#ffffff" ratio="0" alpha=".15"/>
<GradientEntry color="#ffffff" ratio="1" alpha=".1"/>
</LinearGradient>
</fill>
</Rect>
<!-- separator dark -->
<Rect x="80" y="0" width="1" height="65">
<fill>
<SolidColor color="#000000" alpha="0.0"/><!--this alpha attribute was set to 0 in order not to appear -->
</fill>
</Rect>
<!-- highlight border trailing -->
<Rect x="81" y="1" width="1" height="63">
<fill>
<LinearGradient x="0" scaleX="63" rotation="90">
<GradientEntry color="#ffffff" ratio="0" alpha=".15"/>
<GradientEntry color="#ffffff" ratio="1" alpha=".1"/>
</LinearGradient>
</fill>
</Rect>
<!-- invisible fix for scaling -->
<Rect x="0" y="0" width="82" height="65">
<fill>
<SolidColor color="#ffffff" alpha="0"/>
</fill>
</Rect>
< /圖形>
然後我創建的用下面的代碼
包皮 { 進口assets.mobile.BorderlessNavigationButtonSkin延伸TransparentNavigationButtonSkin一個新的Button皮膚;
import mx.core.mx_internal;
import spark.skins.mobile.TransparentNavigationButtonSkin;
use namespace mx_internal;
public class NavigationButtonSkin extends TransparentNavigationButtonSkin
{
public function NavigationButtonSkin()
{
super();
upBorderSkin = assets.mobile.BorderlessNavigationButtonSkin;
downBorderSkin = assets.mobile.BorderlessNavigationButtonSkin;
}
override mx_internal function layoutBorder(unscaledWidth:Number, unscaledHeight:Number):void
{
// trailing vertical separator is outside the right bounds of the button
//setElementSize(border, unscaledWidth + layoutBorderSize, unscaledHeight);
//setElementPosition(border, 0, 0);
setElementSize(border, 0, 0);
setElementPosition(border, 0, 0);
}
override protected function getBorderClassForCurrentState():Class
{
if (currentState == "down")
return downBorderSkin;
else
return upBorderSkin;
}
}
}
,並最終在該行動小組或navigationGroup動作條
的內線按鈕的應用程序級別的全局CSS樣式|動作條S |集團#navigationGroup S |按鈕 { 的skinClass:的ClassReference( 「skins.NavigationButtonSkin」); }
我肯定有通過設置upBorderSkin和downBorderSkin在CSS類只加FXG文件更簡單的方法,但對我來說我也創建了一個自定義動作條,因爲我不想背景漸變以及頂部和底部的邊界,它變得有點複雜