Data binding will not be able to detect assignments to “SOME_STATIC_VARIABLE”.

If you want to bind in MXML to some static variable compiler will warn you that data changes to the value will be unnoticed with the following warning:

Data binding will not be able to detect assignments to "SOME_STATIC_VARIABLE".

I don’t like compiler errors and don’t like compiler warnings as well. So, to avoid this warning you can do the following:

Instead of:

    <mx:TextInput enabled="{iUserAccessId == GLOBAL.m_iAllowTextInput}" />;

you can do this:

    <mx:Script>
        <![CDATA[
             [Bindable]
            private var iCanEdit:uint = GLOBAL.g_iAllowTextInput;
        ]]>
    </mx:Script>
    <mx:TextInput enabled="{iUserAccessId == iCanEdit}" />

Voilà!

2 Responses to “Data binding will not be able to detect assignments to “SOME_STATIC_VARIABLE”.”

  1. […] don’t specifically tell to compiler that class Parent is bindable, compiler will give you the infamous warning on the attempt to bind to any public member of the Parent class: Data binding will not be able to […]

  2. Andre Gott says:

    Thanks, this really helped.

    BTW, the source windows are quite narrow, and therefore distracting. (I checked both IE and FF.)

Leave a Reply