Search code examples
apache-flexactionscript-3flex4

Data binding will not be able to detect assignments to "topLevelApplication"


I am migrating an application from Flex 3 to Flex 4. In some cases there are popup windows of which the width and height is bound to the application width and height.

width="{Application.application.width - 24}" 
height="{Application.application.height - 32}"

Application.application is deprecated in 4.0. so I have replaced this with

width="{FlexGlobals.topLevelApplication.width - 24}" 
height="{FlexGlobals.topLevelApplication.height - 32}"

Now the compiler gives the warning that data bindings cannot be detected for topLevelApplication.

Data binding will not be able to detect assignments to "topLevelApplication"

My question is: Is there another (bindable) property somewhere that I can use to get the same functionality as before?


Solution

  • Just create a variable of type object and make it bindable :

    [Bindable]
    private var application:Object = FlexGlobals.topLevelApplication;
    

    And then use the variable.

    height="{application.height}"