6 Replies Latest reply on Jul 25, 2008 3:42 PM by Gregory Lafrance

    Switching Between Applications In Single Project


      Has anyone tried creating a llinkbar or option bar to allow users click back and forth between application files in a project? I tried using <mx:Button label="Refresh Database Results" click="rssRequest.send()"/> However, the only thing I seem to see is to call up a new external url, which is not what I want.

      Does anyone know how to call between application files in Flex internally? eg. hello.mxml tries to use something like <mx:Button label="Refresh Database Results" click="Go to main.mxml application"/> ?

      Thanks in advance.

        • 1. Re: Switching Between Applications In Single Project
          ntsiii Level 3
          Not clear on what you want. Lets be careful with our language. "mxml files" are source code and do not load or run and you cannot go to them.

          Do you mean that you have two separate applications, (Main.swf and Hello.swf, hosted in their own html wrappers, Main.html and Hello.html) and you want to have a click in the currently running application(Hellp) cause the browser to load Main, entirely replacing Hello?

          If so, then you want navigateToURL(). Note that this is NOT a usual kind of navigation in a Flex app.

          Or are you talking about navigation within a Flex application? If so, how did you get to see the Hello component in the first place?

          • 2. Re: Switching Between Applications In Single Project
            alice_data Level 1

            I am currently only accessing the application offline, and therefore I don't plan on using navigate url to do this. I understand that I literally could export the application I tried to link to and navigate to there this way, but I was thinking of something easier. I tried finding something like "browse" when I was establishing the link button that would like to another application, but I didn't see anything when I tried to right click and find the browse button.
            Are you suggesting that the mxml cannot expand itself even when I provide its location?

            All I am thinking of is something simple, and that is to create a link so I can access to another application I made in the same "project' without having to upload anything. Is this possible?

            I hope this is clearer now.
            Thanks for your help.

            • 3. Re: Switching Between Applications In Single Project
              ntsiii Level 3
              "..mxml cannot expand itself .." Correct. Statement, not suggestion. It must be pre-compiled into a swf.

              Still not clear. Exactly what do you mean by "...access to another application..."?

              Are you talking about running different applications in Flex Builder?


              • 4. Re: Switching Between Applications In Single Project
                alice_data Level 1
                Hi, Tracy:

                Yes, I have currently one panel that displays information from a database query, and I am planning having another button on the same panel to allow users click and look at the results from another query.

                I have the code below like this:

                <mx:Panel id="pane2" title="Information1" layout="absolute">
                <mx:VBox width="450">
                <mx:DataGrid id="patient_info" width="100%" height="373"
                <mx:DataGridColumn headerText="ID" />
                <mx:DataGridColumn headerText="Name" />
                <mx:DataGridColumn headerText="Parent's Name"/>
                <mx:Button label="Refresh Database Results" click="rssRequest.send()"/>
                <mx:Button id="friends" label="Address Book" click="navigateToURL(new URLRequest('addressbook.mxml'));" />

                Instead of using navigateToURL, since my application is designed to be used offline except for using HTTPService to retrieve external information, how could I allow users to click on the Address Book button and read the information from what is in the addressbook.mxml if it does not expand? Would I have to expand addresbook.mxml into addressbook.html and have it be linked to there using something like C:/Documents and Settings/addressbook.html?

                I hope this is clearer now.
                Thanks for your help.

                • 5. Re: Switching Between Applications In Single Project
                  ntsiii Level 3
                  Forget navigateToURL. Stop thinking about "files" and start thinking about containers and components components.

                  Implement your app using a ViewStack navigation component. For each major part of your app, create a component. Put each of those in the viewstack. To move from one view to another, set the selectedIndex of the ViewStack.

                  Actually, you need to stop coding and do some studying on Flex Application component architecture. Start here:


                  • 6. Re: Switching Between Applications In Single Project
                    Gregory Lafrance Level 6
                    Here is an example of an app using ViewStack to display various custom components. Make sure the components for this example are in the components/viewstackFormChildren directory, with the components directory being a sub-directory of the directory where ViewStackFormSite1.mxml is located.

                    But also definitely see the link Tracy provided because you need to understand architecting Flex apps. You don't need to be an expert to get started, but ya gotta get started.