I was adding some extra functionality to my application and ran across an issue that took me a little while to figure out. Once I figured out the fix I thought I would share this with everyone.
Here is my mx:Button inside my application
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <mx:Button height="15" id="cropMode" includeInLayout="{(maskedImage)? true:false}" selected="{imageBoundingBox != null}" styleName="btnCropImageMode" toggle="true" toolTip="Crop Image" width="21" x="547" y="24" click="onModeClick(event)" tabEnabled="false" visible="{(maskedImage)? true:false}" /> |
Notice the binding on the selected attribute of the button. It has a conditional statement in it, but what if you want to add more conditional statements to a binding element, what do you do?
Well here is the fix. All you have to do is replace the normal && signs with the html version. So it would look like this.
1 | selected="{(imageBoundingBox != null) && (boundingBox.visible == false)} |
Notice the html code that is in between the conditional statements. I tried to use <![CDATA[]]> but that didn’t work. So the only fix was to put the html code in there and it worked like a charm.
I hope this saves someone some time.
T