Try setting the Rect's width/height to 100%:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>

    <s:Group width="100%" height="28">
        <s:Rect top="0" right="0" bottom="0" left="0">
            <s:fill>
                <s:SolidColor color="green" />
            </s:fill>
        </s:Rect>
    </s:Group>

    <s:HGroup width="100%" height="28">
        <s:Rect width="100%" height="100%">
            <s:fill>
                <s:SolidColor color="red" />
            </s:fill>
        </s:Rect>
    </s:HGroup>

</s:Application>


Not exactly sure why using left/right/top/bottom constraints didn't work on the 
bottom HGroup, but feel free to file a bug at http://bugs.adobe.com/flex/ and 
Adobe can look into it.

Peter



From: [email protected] [mailto:[email protected]] On Behalf 
Of bhaq1972
Sent: Thursday, April 22, 2010 4:53 AM
To: [email protected]
Subject: [flexcoders] Flex 4 HGroup and Group background colour



Why does this work

<s:Group width="100%" height="28">
<s:Rect top="0" right="0" bottom="0" left="0">
<s:fill>
<s:SolidColor color="0x4960a6" />
</s:fill>
</s:Rect>
</s:Group>

But this doesnt?
<s:HGroup width="100%" height="28">
<s:Rect>
<s:fill>
<s:SolidColor color="0x4960a6" />
</s:fill>
</s:Rect>
</s:HGroup>

thanks

Reply via email to