动态折叠Spark BorderContainer不会折叠其子项

时间:2010-09-02 15:33:24

标签: flex flex3 flex4

             

protected function lbHideQuery_clickHandler(event:MouseEvent):void
        {
            if (lbHideQuery.selected)
            {
                lbHideQuery.label = "Show Query Panel";
                origHeight = canvas1.height;
                canvas1.height = 0;

            }
            else
            {
                lbHideQuery.label = "Hide Query Panel";
                canvas1.height = origHeight;

            }
        } 
    ]]>
</mx:Script>
<mx:LinkButton  label="Hide Query Panel" id="lbHideQuery" toggle="true" click="lbHideQuery_clickHandler(event)"/>
<mx:Canvas id="canvas1" width="100%" height="20%" backgroundColor="0x353356">
<mx:VBox width="16%" height="90" minHeight="0" minWidth="0" id="vgbtns">
        <mx:Button label="Button 1"/>
        <mx:Button label="Button 2"/>
        <mx:Button label="Button 3"/>
</mx:VBox>      

但在Flex4中,当BorderContainer折叠时,按钮仍然可见。

                                

            }
        } 
    ]]>
</fx:Script>
<mx:LinkButton  label="Hide Query Panel" id="lbHideQuery" toggle="true" click="lbHideQuery_clickHandler(event)"/>
<s:BorderContainer width="100%" height="25%" backgroundColor="0x353356" id="bc1" >
    <s:layout>
        <s:HorizontalLayout paddingLeft="6"/>
    </s:layout>
    <s:VGroup width="16%" height="90" minHeight="0" minWidth="0" id="vgbtns">
        <s:Button label="Button 1"/>
        <s:Button label="Button 2"/>
        <s:Button label="Button 3"/>

    </s:VGroup>
</s:BorderContainer>

1 个答案:

答案 0 :(得分:0)

if (lbHideQuery.selected)
            {
                lbHideQuery.label = "Show Query Panel";
                origHeight = canvas1.height;
                canvas1.height = 0;
                canvas1.visible= false;

            }
            else
            {
                lbHideQuery.label = "Hide Query Panel";
                canvas1.height = origHeight;
                canvas1.visible= true;
            }