There are currently some bugs in the state feature when it comes to
percentage widths/heights, as well as widths and heights that are not
explicitly set.

We are planning on fixing these before release.

-Sho
 

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Stephane De Jonckheere
Sent: Tuesday, October 25, 2005 12:12 AM
To: 'flexcoders@yahoogroups.com'
Subject: [flexcoders] [Flex2] State and size

Hi all, 
I'm currently trying Flex 2 and the new State feature.
I'd like to do some kind of fullscreen button.

I managed to do that in Flex 2 but I have some problems.
First of all I need to set the width and height back in a new State.
Switching back to the Base State (setting currentState to null) is not
working 'cause the panel keep the width and height of the fullscreen
state.
That's why I'm using the restore state. Ain't it a bug in the state
feature?
Or is there something I am not doing correctly?

See code below.

Regards,
Stephane

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml";
xmlns="*">
        <mx:states>
                <mx:State name="FullScreen">
                        <mx:RemoveChild child="{searchPanel}"/>
                        <mx:RemoveChild child="{mainBox}"/>
                        <mx:AddChild target="{appCanvas}"
child="{searchPanel}"/>
                </mx:State>
                <mx:State name="Restore">
                        <mx:PropertyOverride target="{appCanvas}"
property="height" value="100%"/>
                        <mx:PropertyOverride target="{appCanvas}"
property="width" value="100%"/>
                        <mx:PropertyOverride target="{mainBox}"
property="height" value="100%"/>
                        <mx:PropertyOverride target="{mainBox}"
property="width" value="100%"/>
                        <mx:PropertyOverride target="{menuPanel}"
property="height" value="100%"/>
                        <mx:PropertyOverride target="{menuPanel}"
property="width" value="25%"/>
                        <mx:PropertyOverride target="{contentBox}"
property="height" value="100%"/>
                        <mx:PropertyOverride target="{contentBox}"
property="width" value="75%"/>
                        <mx:PropertyOverride target="{searchPanel}"
property="height" value="100%"/>
                        <mx:PropertyOverride target="{searchPanel}"
property="width" value="100%"/>
                        <mx:PropertyOverride target="{resultPanel}"
property="height" value="100%"/>
                        <mx:PropertyOverride target="{resultPanel}"
property="width" value="100%"/>
                </mx:State>
        </mx:states>
        <mx:Script>
        static var fullscreen:Boolean=false;
        </mx:Script>
        <mx:Canvas id="appCanvas" width="100%" height="100%">
                <mx:HDividedBox id="mainBox" width="100%" height="100%">
                        <mx:Panel id="menuPanel" height="100%"
width="25%">
                                <mx:Canvas height="100%" width="100%"/>
                        </mx:Panel>
                        <mx:VBox id="contentBox" height="100%"
width="75%"
hScrollPolicy="off" vScrollPolicy="off">
                                <mx:Panel id="searchPanel" height="100%"
width="100%" resizeEffect="Resize">
                                        <mx:Canvas height="100%"
width="100%" id="canvas1">
                                                <mx:Button x="275"
y="116"
label="Switch"
click="currentState=(fullscreen?'Restore':'FullScreen');fullscreen=!full
scre
en;" id="button1"/>
                                                <mx:Button x="275"
y="156"
label="getState" click="if (currentState!=null) {
mx.controls.Alert.show(currentState.toString()); } else {
mx.controls.Alert.show('Base State'); }" id="button2"/>
                                        </mx:Canvas>
                                </mx:Panel>
                                <mx:Panel id="resultPanel" height="100%"
width="100%">
                                        <mx:Canvas height="100%"
width="100%"/>
                                </mx:Panel>
                        </mx:VBox>
                </mx:HDividedBox>
                
        </mx:Canvas>
</mx:Application>



************************************************************************
***********

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager to [EMAIL PROTECTED]

************************************************************************
***********






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



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

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