Archive

Posts Tagged ‘binding’

Data Binding expressions

March 7th, 2008 No comments

In MXML, you may use expressions as a source of data binding.

Example:

<mx:Label text="Beer" visible="{age >= 18}" />

The Label will only be displayed if the person is 18 or older.

Did you try a more complex expression?

<mx:Label text="Beer" visible="{age >= 18 && gender == 'male'}" />

Ah ha! You get a compiler error. Why? Because you’re inside MXML and the & character is special.

Solution: replace the & with &amp;

<mx:Label text="Beer" visible="{age >= 18 && gender == 'male'}" />
Tags: ,

Switch to our mobile site