As I can get a reference to the main window of an Air Flex application within a component? (The component is not in the main MXML)
A:
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
www.Flextras.com
2010-07-13 17:46:07
Hi:Tanks for answer...but spark.components.Application has no application property....Im in flex 4.
caeycae
2010-07-13 18:02:00
I updated my answer accordingly. In flex 4 use FlexGlobals.topLevelApplication .
www.Flextras.com
2010-07-13 19:00:10
yes tanks a lot
caeycae
2010-07-16 15:37:53
+1
A:
Try FlexGlobals.topLevelApplication as WindowedApplication for flex4. Should do 'er.
jeremy.mooer
2010-07-13 18:44:08