user979331
user979331

Reputation: 11871

Adobe Flex center label over image

I am trying to center a label over an image, but its not working, it stays at the top left corner....please help:

<mx:Canvas>

        <mx:Image id="img" showEffect="Fade" completeEffect="{fader}" />

        <s:HGroup verticalAlign="middle" horizontalAlign="center">

            <mx:Label id="touchBegin" text="Touch the screen to continue" fontSize="72" />

        </s:HGroup>

    </mx:Canvas>

Upvotes: 0

Views: 61

Answers (1)

fsbmain
fsbmain

Reputation: 5267

I don't have IDE opened, but I'm pretty sure that's because of the width of the hgroup does not match the one of an image, try:

<s:HGroup verticalAlign="middle" horizontalAlign="center" width="{img.width}">

Upvotes: 3

Related Questions