Apache flex 在Flex 4中使背景图像居中
CustomAppSkin类Apache flex 在Flex 4中使背景图像居中,apache-flex,flex4,Apache Flex,Flex4,CustomAppSkin类 <?xml version="1.0" encoding="utf-8"?> <s:Skin name="CustomApplicationSkin" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" alpha.disabled="0.5"> <s:st
<?xml version="1.0" encoding="utf-8"?>
<s:Skin name="CustomApplicationSkin"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
alpha.disabled="0.5">
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
</s:states>
<fx:Metadata>
<![CDATA[
[HostComponent("spark.components.Application")]
]]>
</fx:Metadata>
<!-- fill -->
<s:BitmapImage id="img" fillMode="clip" horizontalCenter="0" verticalCenter="0"
source="@Embed('assets/images/bg_with_Steps.png')"
smooth="true"
left="0" right="0"
top="0" bottom="0" />
</s:Skin>
如何将背景图像居中对齐。这段代码在我的皮肤类中。我的主课
<?xml version="1.0" encoding="utf-8"?>
<s:Application name="Spark_Application_skinClass_test"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
skinClass="CustomAppSkin">
<s:layout>
<s:VerticalLayout
horizontalAlign="center"
verticalAlign="middle"/>
</s:layout>
</s:Application>
尝试将您的CustomAppSkin更新为:
<?xml version="1.0" encoding="utf-8"?>
<s:Skin name="CustomApplicationSkin"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
alpha.disabled="0.5">
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
</s:states>
<fx:Metadata>
<![CDATA[
[HostComponent("spark.components.Application")]
]]>
</fx:Metadata>
<!-- fill -->
<s:HGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">
<s:BitmapImage id="img" fillMode="clip" horizontalCenter="0" verticalCenter="0"
source="@Embed('assets/images/bg_with_Steps.png')"
smooth="true"
left="0" right="0"
top="0" bottom="0" />
</s:HGroup>
</s:Skin>
那个“皮肤类”看起来当然不像皮肤类。我不能在图像上放置任何东西,我是说组件或其他东西。。。。为什么???将对象放在HGroup上,而不是图像上