1 Reply Latest reply on Oct 5, 2009 8:55 AM by Gregory Lafrance

    passing data from a container to another

    Alex-SM Level 1

      Hi,

       

      Let's say I have two containers (Container1=application , Container2).  Container1 gets some data from user, perform some database lookup and displays Container2 with the results from database lookup.

       

      Container1 --(call and display)--> Container2

       

      Below shows  how I am using a bindable variable in Container1 to pass the data from Container1 to Container2.  Also shows how I display Container2 from Container1.

       

      <!-- Container1 -->

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">


         ....
         [Bindable] public var foo:String = "bar";
         ....
         private function loginHandler(event:LoginEvent):void
         {
            mycontainer2 = new Container2();
            mycontainer2.name = "mycontainer2";
            this.addChild(mycontainer2);
         }
      </mx:Application
      >

       

       

      I am accessing the data in Container2 as follow:

       

      <!-- Container2 -->

      {mx.core.Application.application.foo}

       

       

      Q1) Is there a better way to pass data from one container to another and access the data?

       

      Q2) Is this the only way to call and display Container2 from Container1?

       

      Q3) How can I move back to Container1 from Container2, i.e. Container2 call and display Container1

             Container2 --(back to)--> Container1