3 Replies Latest reply on Jan 16, 2009 8:20 AM by Newsgroup_User

    Passing data between 2 component

    Wirawannaga
      Can anybody give me idea that how to passing set of data from 1 component into another component. For example 1st component have form and datagrid. Another component have plot chart. So every time the data grid change value the plot graph also changing. The problem are i can figure out how to transfer the data to another component. Can anybody give a idea?
        • 1. Re: Passing data between 2 component
          Madhav Subedi Level 4
          well, i think all the mxml components have public scope. so does your datagrid.
          now you can make a controller class having a static public member
          c1:Component1
          now in initialize event of the component1, save its instance to controller.
          Controller1.c1 = this;
          now in Component 2, you can access the data grid as:
          Controller1.c1.datagridID

          hope it works.
          • 2. Re: Passing data between 2 component
            John Hall Level 4
            Looks like you want to dive in to databinding and understanding how collections can help manage different views of the same information. If you're not used to using collections (xmllistcollection, arraycollection, grouping collections etc), it would be a good starting place to read more about databinding in the help file. If you're wanting to share that collection across components, that really depends on how you architected your application. If you're not using a framework like Cairgorm or Mate, you'll want to learn more about eventListeners and dispatching events, especially custom events.
            • 3. Re: Passing data between 2 component
              Level 7

              "John Hall" <webforumsuser@macromedia.com> wrote in message
              news:gkpinb$t3r$1@forums.macromedia.com...
              > Looks like you want to dive in to databinding and understanding how
              > collections
              > can help manage different views of the same information. If you're not
              > used to
              > using collections (xmllistcollection, arraycollection, grouping
              > collections
              > etc), it would be a good starting place to read more about databinding in
              > the
              > help file. If you're wanting to share that collection across components,
              > that
              > really depends on how you architected your application. If you're not
              > using a
              > framework like Cairgorm or Mate, you'll want to learn more about
              > eventListeners
              > and dispatching events, especially custom events.

              Also, you might find the links in the answer to Q3 useful
              http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf