As I can get a reference to the main window of an Air Flex application within a component? (The开发者_Python百科 component is not in the main MXML)
Try FlexGlobals.topLevelApplication as WindowedApplication for flex4. Should do 'er.
This should do it:
var topLevelApplication : Application = Application.application as WindowedApplication
Reference: http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#application
In Flex 4, you should use the topLevelApplication property of the FlexGlobals class, something like this:
var topLevelApplication : Application = FlexGlobals.topLevelApplication as WindowedApplication
精彩评论