Search code examples
flex3adobe

How to write '{' in inline event handler in the mxml tag itself?


How to write '{' in inline event handler in the mxml tag itself? Suppose I want to write this and dont want to make a function for this two line statement...

click="{if { (_absences!='')chkAbsences.selected = true; chkRegularHrs.selected = false;} else {chkAbsences.selected=false};}"

Thanks guys...


Solution

  • you have to escape that character. the same happens with the &. When compiling MXML, first it has to be a valid XML file. So, there are certain characters for which you need to accommodate and write ugly stuff like if ( X && Y ) ...

    How to escape..

    PS: Do what @bedwyr says and use a script block for lengthy functions. you'll thank him/her later.