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 = fal开发者_运维知识库se;} else {chkAbsences.selected=false};}"
Thanks guys...
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.
It's really simple:
<s:Button>
<s:click>
<![CDATA[
function clickHandler(event:MouseEvent):void
{
trace("CLICK!");
}
]]>
</s:click>
</s:Button>
精彩评论