Multiple Conditions in mxml (using symbols like &)

This post was moved to


Often we try to put in conditions to enable/disable components in mxml. Its straight forward if we have one condition to do this.
For eg:

<s:Button enable={flag1} label="Test Button"/>

But if we want to put in multiple conditions then we will run into compiler errors if we use symbols (like &(AND), although |(OR) seems fine).
For eg:

<s:Button enable={flag1&&flag2} label="Test Button"/>

Here is the solution for this. Instead of putting the condition we can put in the condition in a function and bind the function.
For eg:

<s:Button enable={enableButton()} label="Test Button"/>


private function enableButton():Boolean{	return flag1&&flag2;}