Actionscript 3 Flex 4.6中心图像

Actionscript 3 Flex 4.6中心图像,actionscript-3,flash,apache-flex,actionscript,Actionscript 3,Flash,Apache Flex,Actionscript,我正在使用Adobe Flex 4.6,我有以下图像: <mx:Image source="assets/logo.png" horizontalAlign="center" verticalAlign="middle"></mx:Image> 图像出现,但它不居中水平或垂直,如何居中此图像 我还尝试了以下方法: <mx:Canvas width="100%"> <mx:HBox horizontalCenter="0" verti

我正在使用Adobe Flex 4.6,我有以下图像:

<mx:Image source="assets/logo.png" horizontalAlign="center" verticalAlign="middle"></mx:Image>

图像出现,但它不居中水平或垂直,如何居中此图像

我还尝试了以下方法:

<mx:Canvas width="100%">
        <mx:HBox horizontalCenter="0" verticalCenter="0">
            <mx:Image source="assets/logo.png" horizontalAlign="center" verticalAlign="middle"></mx:Image>
        </mx:HBox>
    </mx:Canvas>


仍然没有,我的图像不会居中使用图像标记中的horizontalCenter和VerticalCenter属性,如下所示

<mx:Image source="assets/logo.png" horizontalCenter="0" verticalCenter="0"></mx:Image>

这对我来说很好。

这对我来说很好

<s:Group width="100%" height="100%">
        <s:layout>
            <s:VerticalLayout
                verticalAlign="middle"
                horizontalAlign="center"/>
        </s:layout>
        <s:BitmapImage source="@Embed(source='assets/logo.png')" />

    </s:Group>

它会工作的。如果您有某个容器具有此图像,则将该容器的高度和宽度设置为100%