[FLEX]-控制項的內容指定[bindable]變數所產生的warnning

摘要:[FLEX]-控制項的內容指定[bindable]變數所產生的warnning

當在flex的mxml中指定某個控制項的值為綁定的變數時,例如

<s:Label x="117" y="213" text="{strType}" id="lblType" />

compile時就會出現下面這種警告

Data binding will not be able to detect assignments to xxxController

 

sol:

ref:reference url


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

By mitek

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}" />