1 Reply Latest reply on Mar 2, 2008 12:21 PM by pabera

    Accessing a Variable from another component

    pabera Level 1
      Hey,

      I have got a main application with different states.. in the states I call different components.
      like this:
      quote:

      <mx:State name="products">
      <mx:AddChild>
      <modules:Products/>
      </mx:AddChild>
      </mx:State>

      <mx:State name="add_offer">
      <mx:AddChild>
      <modules:AddOffer bufferedProduct="{}" />
      </mx:AddChild>
      </mx:State>


      In the product component, I have a button which saves some information to a variable called "bufferedProduct". after that the program leaves the state "products" und switches to the state "add_offer", which is a different component. There I need the saved information from the "bufferedProduct" variable.

      Now my question, how can I "transfer" the information previously stored within the "Products" component in the "bufferedProduct" var into the "addOffer" component? Is there a way I can do that? Or should I use a different way to build my application :)

      this does not work unfurtunately!
      quote:

      parentDocument.products.bufferedProduct


      thx in advance
      pat
        • 1. Accessing a Variable from another component
          pabera Level 1
          Hey,

          I actually found one answer myself.
          I created a var bufferedProduct in the main app. In te Products state, I save the information to "parentDocument.bufferedProduct" and then I sent the var to the other component like this

          quote:

          <modules:AddOffer bufferedProduct="{bufferedProduct}" />


          in the addOffer component I just had to declare another var with the same name and thats it.

          thx anyway.
          pat