2 Replies Latest reply on Feb 24, 2007 3:34 AM by rayess

    Accessing Root Object

    babo_ya Level 3
      If I have a function called 'SampleFunction' in my root function then I can access it by calling mx.core.Application.application.SampleFunction(). But, If I have an object created for example, var cart:Cart = new Cart(); in the root level, then I can't access it by mx.core.Application.application.cart????
      Does anyone know how to access root level object from anywhere in my project?

        • 1. Re: Accessing Root Object
          well you definately should..

          is the object you're trying to access public, like
          public var cart:Cart = new Cart(); ?

          if you try to access it from inside a different class,
          did you import mx.core.Application in this class?

          That's all i can think about whats wrong..
          • 2. Re: Accessing Root Object
            yes that's right.

            u need to define the variable as public and then u can refer to it from any other place using either the mx.core.Application.application.#yourVar or simplt parentDocument.#yourVar.