I'm trying to create a wizard based application.  I'm having trouble 
sending arguments to my "back" and "next" buttons using 
addEventListener. 


Basically, when my app loads, in the viewstack, the second screen is 
loaded, i.e. it loads before the user gets a chance to hit the next 
button.  I'm trying to have it load the first screen and then go to 
the 
second screen after the user presses the next button. 


Anyone see what I'm doing wrong? 


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; 
        height="100%" 
        width="100%"
        >

<mx:Script>
<![CDATA[

function initialize(screenx){
        switch(screenx){
                case screen1:
                        mainPanel.title = "screen1";
                        statusLabel.text = "screen1";
                        backButton.visible = false;             
                        
                        backButton.label = "Back";
                        nextButton.label = "Start";
                        nextButton.addEventListener( "click", 
goToScreen(screen2));
                        break;
                        
                case screen2:
                        mainPanel.title = "screen2";
                        statusLabel.text = "screen2";
                        backButton.visible = true;              
                        
                        backButton.label = "Back";
                        nextButton.label = "Next";
                        nextButton.addEventListener( "click", 
goToScreen(screen3));                   
                        break;
        
                case screen3:
                        mainPanel.title = "screen3";
                        statusLabel.text = "screen3";
                        backButton.visible = true;              
                        
                        backButton.label = "Back";
                        nextButton.label = "Next";
                        nextButton.addEventListener( "click", 
goToScreen(screen1));                   
                        break;                  
        }
}


function goToScreen(x){
        mainViewStack.selectedChild = x;

}
                
]]>
</mx:Script>
        
                
        <!-- Main Panel (mainViewStack=0) -->
        <mx:Panel id="mainPanel" title="" width="100%" height="100%" 
styleName="mainPanel">
                <!-- Main ViewStack -->
                <mx:ViewStack id="mainViewStack" width="100%" 
height="100%">
                
                        <!-- mainViewStack.selectedChild=screen1  -->
                        <mx:VBox id="screen1" width="100%" 
height="100%" creationComplete="initialize(screen1);">          
        
                                <mx:Text text="This is screen1." 
width="100%"/>
                        </mx:VBox>
                        
                        <!-- mainViewStack.selectedChild=screen2 -->
                        <mx:VBox id="screen2" width="100%" 
height="100%" creationComplete="initialize(screen2);">
                                <mx:Text text="This is screen2." 
width="100%"/>                          
                        </mx:VBox>              

                        <!-- mainViewStack.selectedChild=screen3 -->
                        <mx:VBox id="screen3" width="100%" 
height="100%" creationComplete="initialize(screen3);">
                                <mx:Text text="This is screen3." 
width="100%"/>
                        </mx:VBox>      

                </mx:ViewStack>
                <!-- End Main ViewStack -->
                        <!-- The Control Bar -->
                        <mx:ControlBar>
                                        <mx:HBox width="50%" 
horizontalAlign="left">
                                                <mx:Label 
id="statusLabel" text="" width="200"/>
                                        </mx:HBox>
                                        <mx:HBox width="50%" 
horizontalAlign="right">
                                                <mx:Button 
id="backButton" label="Back" click="" />
                                                <mx:Button 
id="nextButton" label="Next" click="" />
                                        </mx:HBox>
                        </mx:ControlBar>        
                </mx:Panel>
                <!-- End Main Panel -->
</mx:Application>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/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