parentApplication and FlexGlobals.topLevelApplication in Flex 4

Vijey picture Vijey · May 25, 2011 · Viewed 7.6k times · Source

In Flex 4, are there any differences between parentApplication and FlexGlobals.topLevelApplication? Are referring to the same top level application?

I think both are same; one (parentApplication) belongs to Spark and the other (FlexGlobals.topLevelApplication) belongs to Halo. Is my understanding correct?

Answer

Dennis Jaamann picture Dennis Jaamann · May 25, 2011

Check out this Adobe livedoc, it clearly states:

  • mx.core.FlexGlobals.topLevelApplication: The top-level application object, regardless of where in the document tree your object executes. This object is of type spark.components.Application or mx.core.Application.

  • mx.core.UIComponent.parentDocument: The parent document of the current document. You can use parentDocument.parentDocument to walk up the tree of multiple documents.

  • mx.core.UIComponent.parentApplication: The Application object in which the current object exists. Applications can load other 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.

Cheers