3 Replies Latest reply on Mar 17, 2008 8:14 AM by Gregory Lafrance

    Accesing state elements from .as

    TrAvIkK
      Hi there ;)

      OKay - I know I can access state elements from .mxml file with actionscript, by elemName, but how to do it from separated, imported .as file? Also, how to access application properties such as currentState from those files?
        • 1. Re: Accesing state elements from .as
          Gregory Lafrance Level 6
          Flex provides the following properties that you can use to access parent documents:

          Application.application The top-level Application object, regardless of where in the document tree your object executes.

          parentDocument The parent document of the current document. You can use parentDocument.parentDocument to walk up the tree of multiple documents.

          parentApplication The Application object in which the current object exists. Flex applications can load applications into applications, therefore, you can access the immediate parent application by using this property. You can use parentApplication.parentApplication to walk up the tree of multiple applications.

          • 2. Re: Accesing state elements from .as
            TrAvIkK Level 1
            So, for example I can use:
            Alert.show( message + " currentState: " + parentDocument.currentState );

            to view currentState name? Well, it is not working, as long as external .as file concerned.
            • 3. Re: Accesing state elements from .as
              Gregory Lafrance Level 6
              In your case you might need to use Application.application.