I found this example in help and wonder how to make it works:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml";
mouseDown="checkCollapse(event)" resizeEffect="Resize">
    <mx:Script>
    <![CDATA[
        private function checkCollapse(event:MouseEvent):void
        {
            // If the user clicks the panel header, collapse/expand the panel.
            if (event.localY < getStyle("headerHeight")) {
                currentState = currentState == "collapsed" ? "" : "collapsed";
            }
        }
    ]]>
    </mx:Script>

    <mx:states>
        <mx:State name="collapsed">
            <mx:SetProperty name="height" value="{getStyle('headerHeight')}"/>
        </mx:State>
    </mx:states>
</mx:Panel>

I just wrapped it into application:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>

    <mx:Script>
    <![CDATA[
        import mx.controls.Alert;
        private function checkCollapse(event:MouseEvent):void
        {
            // If the user clicks the panel header, collapse/expand the panel.
            if (event.localY < getStyle("headerHeight")) {
                currentState = currentState == "collapsed" ? "" : "collapsed";
            }
        }
    ]]>
    </mx:Script>

    <mx:states>
        <mx:State name="collapsed">
            <mx:SetProperty name="height" value="{getStyle('headerHeight')}"/>
        </mx:State>
    </mx:states>

        <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml";
mouseDown="checkCollapse(event)" resizeEffect="Resize">
                <mx:TextArea />
        </mx:Panel>
        

</mx:Application>

You could check via debugging that (event.localY <
getStyle("headerHeight")) is always false.

On 8/11/06, Sergey Kovalyov <[EMAIL PROTECTED]> wrote:
> Hi All!
>
> I want to create collapsable Panel via states. I use <mx:SetProperty>
> to change height to myPanel.getStyle("headerHeight") value, but this
> method return undefined. What is wrong?
>
> Regards, Sergey.


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to