Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
face7hill #1
sending arguments to addEventListener
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 = "Next";
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>
face7hill Guest
-
How to spry addEventListener?
How can I display all the items when selecting a category (menu)? At the moment is showing only the first item from the dsData set. in the <div... -
Sending arguments to FMS with FLVPlayback
In developing an application, using the FLVPlayback component to stream video, I need to find a way to send TO Flash Media Server a few various... -
Sending contact form info from Flash to ASP.net forwebmail sending
Hello, I am trying to complete a web contact form within a Flash movie. The form has already been designed. Now I am trying to send the form... -
Getting URL arguments
I'm trying to read the arguments of the URL for the document. I'm new to PHP and can't figure it out. I've played around with $_SERVER but the... -
Button and addEventListener
Okay, It looks to me like I need to lie to flash to make this work. Can someone confirm that I am not being incredibly stupid here: Scenario...



Reply With Quote

