Migrating From FLEX 3 to FLEX 4: FlexGlobals.topLevelApplica
Sun Feb 7 04:16:48 2010
Today I cam across an interesting problem while working with the new Flex 4 SDK. I kept getting the following error.
Warning: 'application' has been deprecated since 4.0. Please use 'FlexGlobals.topLevelApplication'.
Naturally, I had no idea what this meant until I did a little research. Apparently, an application runs in its own ApplicationDomain which in turn has it's own topLevelApplication. Thus, you have to set the correct reference to the constructor of said top level application in order to get rid of the warning.Replace this...
var mxmlApp:Application = Application(Application.application);with this...
var mxmlApp:Object = FlexGlobals.topLevelApplication;...and the sun will shine once more. Tweet