Flex 4.6 Image Center

I am using Adobe Flex 4.6 and I have this image:

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

The image appears, but it is not in the center horizontally or vertically, how do I center this image?

I also tried the following:

<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>

Still nothing, my image will not be focused

+4
source share
2 answers

It worked for me

<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>
+4
source

Use the horizontalCenter and VerticalCenter properties in the image tag as shown below

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

It works great for me.

0
source

Source: https://habr.com/ru/post/1667294/


All Articles