我有一些具有子组件的可换肤容器,例如图像组件或按钮栏等。似乎当我添加皮肤时,可换肤容器看起来很棒,但该容器的所有子组件似乎都消失了。
Example:
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<!-- host component -->
<fx:Metadata>
[HostComponent("path.to.skin.MySkinnableContainer")]
</fx:Metadata>
<s:states>
<s:State name="disabled" />
<s:State name="normal" />
</s:states>
<mx:Image source="@Embed('path.to.skin.AllSkinArt.swf#SkinArt')" includeIn="normal"/>
<!-- SkinParts
name=contentGroup, type=spark.components.Group, required=false
name=contentGroup, type=spark.components.Group, required=false
-->
</s:Skin>
将被蒙皮的组件,具有蒙皮时消失的图像组件。
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="116" height="74"
addedToStage="onAddedToStage(event)">
<fx:Script>
<![CDATA[
[Bindable]
private var _screenShot:Bitmap;
public function updateScreenShot(screenShot:Bitmap):void
{
_screenShot = screenShot;
}
protected function onAddedToStage(event:Event):void
{
//do not want the mouse to interact with this object.
this.mouseEnabled = false;
}
]]>
</fx:Script>
<s:Image
width="115"
height="82"
x="-8"
y="-109"
source="{_screenShot}"/>
</s:SkinnableContainer>
在 CSS 文档中,我有以下代码行来设置皮肤。
wd|MySkinnableContainer
{
skinClass: ClassReference("path.to.MySkinnableContainerSkin");
}
在上面的示例中,Skin 工作得很好,但是 SkinnableContainer 中包含的图像会消失。