2 Replies Latest reply on Jan 30, 2008 10:48 PM by Gregory Lafrance

    Help with Buttons

    spetersen487
      I am still very much a newbie when it comes to Flex. Right now I am having problems with click events for buttons. Here is my issue, I have one main mxml application and 2 sub mxml applications within my project.

      In my main application I want 2 buttons, one for each sub application that is in the project. When I click a button, I want to leave my main application and open one of the sub applications, without opening a new browser window. I simply can't figure out how to accomplish this.

      Any help would be greatly appreciated.

      Thank you inadvance.

      -Steve
        • 1. Re: Help with Buttons
          w_m_n
          as per your requirement you can use execute this on click
          navigateToURL(new URLRequest("html wrapper of the next app you want to go to"),"_self");

          If you just want to change views - viewStack or States might be a better option.
          • 2. Re: Help with Buttons
            Gregory Lafrance Level 6
            ----------------------------- Test.mxml --------------------------------------
            <?xml version="1.0"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:comp="*">
            <mx:HBox>
            <mx:Button id="subBtn1"
            label="Sub App One"
            click="myViewStack.selectedChild=sub1;"/>
            <mx:Button id="subBtn2"
            label="Sub App Two"
            click="myViewStack.selectedChild=sub2;"/>
            </mx:HBox>
            <mx:ViewStack id="myViewStack"
            borderStyle="solid" width="100%" height="100%">
            <comp:SubOne id="sub1"/>
            <comp:SubTwo id="sub2"/>
            </mx:ViewStack>
            </mx:Application>
            ------------------------------- SubOne.mxml ---------------------------------
            <?xml version="1.0" encoding="utf-8"?>
            <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%" backgroundColor="#ccffff">
            <mx:Text text="This is sub application one."/>
            </mx:VBox>

            ------------------------------- SubOne.mxml ---------------------------------
            <?xml version="1.0" encoding="utf-8"?>
            <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%" backgroundColor="#ffcccc">
            <mx:Text text="This is sub application two."/>
            </mx:VBox>