2 Replies Latest reply on Sep 21, 2008 6:52 AM by nagarjunaakkineni

    Pass value from one page to another

    Level 1

      Hi All,
      "How to pass the value from one Flex page to anothere Flex page".

      In First Flex page contains One Inputtext and one button is there.After entering the data in inputtext box,the user clicks on the button then get the data from inputtext box and then i need to send that value to another flex page and display there.

      Can u tel me plz............

      Thanks & Regards,
      Nagarjuna.
        • 1. Re: Pass value from one page to another
          Ratsnackbar Level 2
          I believe you are thinking in terms of HTML and traditional page coding. As an old school ColdFusion guy I understand it is difficult to leave that behind. (at least it was for me.) Unless you literally have two different HTML pages that each have their own Flex app running in them you do not need to send data from one page to the next like you would with Web Forms. (If you are doing that you may want to simply write the data to a Shared Object, Pass it to a server to store and then feed back into the second Flex App when it loads or perhaps use the ExternalInterface to then pass it through as a series of URL parameters that can be loaded into the next Flex App.)

          In Flex you do not have to worry about loosing state between pages because there are literally no pages. Only different views. You would not "Send" the value from one page to another. You provide a mechanism for the second view to reference the same model or data object (most call them ValueObjects) that the first view is setting via the form fields.

          You would want to use a ValueObject in the first VIEW and then fill the object with the form data using setter methods on the object. For example set the fields onChange event to call the setter on the object and pass it the form fields value as the property. Alternately you could bind the values of the model directly to the fields so that they automatically obtain the data that is being filled in.

          Depending on how complex of an application you are going to build and how scalable it must eventually be you have many different options to choose from to allow the second View to use the data set but the first. However to make the application ultimately more scalable you are going to want to keep your view separated from the controller and that separated from the Model/ValueObject. (By seperated I mean in different classes.)

          I would suggest looking up the subject of MVC in Flex and also the Mediator Design pattern. There are many great sources of information.

          Here are a few links that may help with ideas.
          http://flexblog.faratasystems.com/?p=246
          http://pages.cpsc.ucalgary.ca/~heatond/mediator/
          http://livedocs.adobe.com/flex/3/html/help.html?content=introbd_2.html
          • 2. Re: Pass value from one page to another
            Level 1
            Hey Ratsnackbar ,
            Can u give me the simple example regarding what i'm asking.
            I don't want those information what u have mention in before message.
            I want only "how to send the information from one flex page to another flex page".that's what i want.......

            Thnaks in advance,
            Nagarjuna.