1 Reply Latest reply on Nov 15, 2007 7:24 AM by Jeffrey_Owen

    how to access variables declared in main mxml in itemrenderer files

    lucky_raga
      Hi,
      I have a main mxml which has a cutomRenderer that defines two mxml components
      namely raidobutton and textinput.
      Now in this TextInput.as i need to access variable defined in main mxml.

      Please suggest a way.

      Thanks,
      Lucky
        • 1. Re: how to access variables declared in main mxml in itemrenderer files
          Jeffrey_Owen
          Lets say you have a public property in your application like

          public var name:String = "John Smith";

          to access this using an inline item renderer:

          <mx:itemRenderer>
          <mx:Component>
          <mx:VBox>
          ...
          <mx:TextInput text={outerDocument.name} />
          ...
          </mx:VBox>
          </mx:Component>
          </mx:itemRenderer>

          To access variables of the applicaton you can use Application.application.name (for example) to reference "global" variables, so you might also use this technique. With an inline item renderer, the outerDocument property will refer to the component which contains the renderer.