在皮膚上打開一個腳本標籤,並做到:
[Embed(source="assets/images/button-up.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "2", scaleGridBottom = "3")]
[Bindable]
public var upImg:Class;
[Embed(source="assets/images/button-over.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "4", scaleGridBottom = "5")]
[Bindable]
public var overImg:Class;
[Embed(source="assets/images/button-disabled-skin.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "2", scaleGridBottom = "3")]
[Bindable]
public var disabledImg:Class;
[Embed(source="assets/images/button-over.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "4", scaleGridBottom = "5")]
[Bindable]
public var downImg:Class;
刪除所有默認填充,而是使用:
<s:BitmapImage source="{upImg}"
source.over="{overImg}"
source.down="{downImg}"
source.disabled="{disabledImg}"
width="100%"/>
瞧」
感謝information.But爲什麼Adobe公司FLEX4刪除按鈕的最簡單的Flex 3的圖像剝皮通過CSS我面臨的困難是用不同的圖像剝皮多個按鈕。 – naveen 2010-09-20 10:51:53
它在火花框架中更加靈活,只需將圖像擴展爲按鈕,然後通過CSS進行設置即可。像http://blog.flexexamples.com/2010/03/24/using-a-bitmap-image-skin-in-a-spark-button-control-in-flex-4/ – Eugene 2010-09-20 12:08:58
+1給尤金一個好答案。是的,你必須通過皮膚來做到這一點,但好消息是你可以創建一個通用皮膚,然後通過在CSS中設置圖像,就像你在Flex 3中做的那樣,將它用於任何按鈕。 – 2010-09-20 21:38:02