4 Replies Latest reply on Apr 21, 2010 10:57 PM by welcomecan

    how to pass data one page to another page?

    welcomecan

      hi to all,

      any body help me.how to pass data one page to another page?

       

       

       

       

      regards

      welcan

        • 1. Re: how to pass data one page to another page?
          Matt Le Fevre Level 4

          what do you mean 'one page to another page' ?

           

           

          do you mean between MXML pages (within your code)?

           

          or do you mean between actual webpages?

          1 person found this helpful
          • 2. Re: how to pass data one page to another page?
            kubens Level 2

            You can use simple variables to pass values. In the example below I have defined a public variable 'fooBar' in App which is set inside the click event handlers of the buttons.

             

            AppMain.mxml:

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
            >

             

                <fx:Script>
                    <![CDATA[
                        import mx.managers.PopUpManager;
                        protected function button1_clickHandler(event:MouseEvent):void
                        {
                            var app:App = new App();
                            app.
            fooBar = 'Hello App 1';

                           
                            PopUpManager.addPopUp(app,this,true);
                            PopUpManager.centerPopUp(app);
                        }
                        protected function button2_clickHandler(event:MouseEvent):void
                        {
                            var app:App = new App();
                            app.fooBar = 'Hello App 2';
                           
                            PopUpManager.addPopUp(app,this,true);
                            PopUpManager.centerPopUp(app);
                        }
                    ]]>
                </fx:Script>
               
                <s:Button label="open App 1" click="button1_clickHandler(event)" horizontalCenter="50" verticalCenter="0"/>
                <s:Button label="open App 2" click="button2_clickHandler(event)" verticalCenter="0" horizontalCenter="-50"/>
            </s:Application>

             

            App.mxml:

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           width="200"
                           height="200"
                           pageTitle="App"
            >
               
                <fx:Script>
                    <![CDATA[
                        import mx.managers.PopUpManager;
                       
                        [Bindable] public var fooBar:String;       
                        protected function button1_clickHandler(event:MouseEvent):void
                        {
                            PopUpManager.removePopUp(this);
                        }

             

                    ]]>
                </fx:Script>

             

                <s:Label text="{fooBar}" horizontalCenter="0" verticalCenter="0" textAlign="center" width="100%"/>
                <s:Button horizontalCenter="0" label="close" click="button1_clickHandler(event)" bottom="10"/>
               
            </s:Application>

            1 person found this helpful
            • 3. Re: how to pass data one page to another page?
              welcomecan Level 1

              send app() code


              • 4. Re: how to pass data one page to another page?
                welcomecan Level 1

                i need  pass data one mxml to another mxml app

                lication