2 Replies Latest reply on May 19, 2008 2:23 AM by nif

    calling variables in different components

    nif Level 1
      hi there,

      i apologise if this is a very silly question, but i am fairly new to flex and busy doing my first project using it and struggling to find the information i need.

      i have created an application that uses components for a multitude of different display areas. one of my areas is a component that calls 2 other components to create an input area and a listing area on the same page.
      i now need the listing area to populate the fields of the input area with data from the listing on selection of certain items in my listing. however, i cannot simply call them by their id as i get the error "Access of undefined property". how do i access the input area component's scope from within the listing component?

      thanks a mil',
        • 1. Re: calling variables in different components
          peterent Level 2
          If you have the id of a component you can reference its public variables and function by using the dot-notation. If "listing" is the id of a component and it has a public variable, "input" you do this:


          to reference the "input" variable (or whatever it is, as long as it is public).
          • 2. Re: calling variables in different components
            nif Level 1
            hi peter,

            thanks for the quick reply. this didn't initially work as the 2 components are sitting on the same "level"... i.e. nested inside another component.
            then i found a reference to a "parentDocument" scope and gave this a bash... so, parentDocument.listing.input and it worked. i hadn't realised the different scopes such as parentDocument, Application and parentApplication existed, or at least how to reference them.
            happy days! :)

            thanks again,