0
我設置標籤和按鈕的皮膚,但是當我嘗試添加代碼,以隨機的皮膚,使皮膚工作得很好,但標籤消失。如果我刪除button1.setStyle(「skinClass」,randomSkin());顯示標籤。標籤消失時,皮膚補充
public function randomSkin():Class{
var randSkin:Array = new Array(Skins.Normal,Skins.Ice,Skins.Fire,Skins.Jewel,Skins.Stone);
var index:Number=Math.floor(Math.random()*randSkin.length);
return randSkin[index];
}
button1.setStyle("skinClass", randomSkin());
button1.label=tiles[0][0];
當我嘗試跟蹤按鈕的標籤,它有一個值,但它不會在按鈕上顯示。
我該如何在按鈕上顯示標籤?
這是皮膚的代碼中的一個,我用
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
width.down="100%" height.down="100%">
<!-- host component -->
<fx:Metadata>
[HostComponent("spark.components.Button")]
</fx:Metadata>
<!-- states -->
<s:states>
<s:State name="disabled" />
<s:State name="down" />
<s:State name="over" />
<s:State name="up" />
</s:states>
<s:BitmapImage includeIn="disabled" left="0" right="0" top="0" bottom="0"
source="@Embed('assets/textures/tiles/fire.png')"/>
<s:BitmapImage includeIn="down" left="0" right="0" top="0" bottom="0" blendMode="difference"
source="@Embed('assets/textures/tiles/fire.png')"/>
<s:BitmapImage includeIn="over" left="0" right="0" top="0" bottom="0"
source="@Embed('assets/textures/tiles/fire.png')"/>
<s:BitmapImage includeIn="up" left="0" right="0" top="0" bottom="0"
source="@Embed('assets/textures/tiles/fire.png')"/>
<s:Group id="contentGroup" top="52" left="5" right="5"/>
</s:Skin>
please,顯示其中一個皮膚代碼 –
cnt發表評論中的代碼。請參見上面的編輯問題。謝謝 – Mirage01