Hi

I am using the viewstack in PopUp. The problem i am facing is that all the 
views inside viewstack gets their CreationComplete called when the popup is 
created. Please see the attached sample code.Is their any way to avoid this? I 
want that only selected view creationcomplete is called and not for other views.


Save File as "TestViewStack.mxml"
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="400" height="300">
        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                ]]>
        </mx:Script>
        <!-- Define the ViewStack and the three child containers and have it
        resize up to the size of the container for the buttons. -->
        <mx:ViewStack id="myViewStack" borderStyle="solid" width="100%" 
height="80%">

            <mx:Canvas id="search" creationComplete="{Alert.show('search')}" 
backgroundColor="#FFFFCC" label="Search" width="100%" height="100%">
                <mx:Label text="Search Screen" color="#000000"/>
            </mx:Canvas>

            <mx:Canvas id="custInfo" 
creationComplete="{Alert.show('custInfo')}" backgroundColor="#CCFFFF" 
label="Customer Info" width="100%" height="100%">
                <mx:Label text="Customer Info" color="#000000"/>
            </mx:Canvas>

            <mx:Canvas id="accountInfo" 
creationComplete="{Alert.show('accountInfo')}" backgroundColor="#FFCCFF" 
label="Account Info" width="100%" height="100%">
                <mx:Label text="Account Info" color="#000000"/>
            </mx:Canvas>
        </mx:ViewStack>
</mx:Canvas>

Save File as "testProject.mxml"

<?xml version="1.0"?>
<!-- Simple example to demonstrate the ViewStack layout container. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
     <mx:Script>
        <![CDATA[
                import mx.managers.PopUpManager;
                import mx.controls.Alert;
                
                public function onTestClick():void
                {
                        var view:TestViewStack = 
PopUpManager.createPopUp(this,TestViewStack) as TestViewStack;
                        PopUpManager.centerPopUp(view);
                }
        ]]>
     </mx:Script>

     <mx:Panel title="ViewStack Container Example" height="95%" width="95%" 
         paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

        <mx:Text width="100%" color="blue"
            text="Use the Button controls to change panels of the ViewStack 
container."/>

        <mx:Button label="Test" click="onTestClick()"/>

        

    </mx:Panel>
</mx:Application>


Reply via email to