Home > AS3.0, Flex, News > Ternary conditionals in MXML bindings

Ternary conditionals in MXML bindings

September 16th, 2008

Ok, I’m not sure how I missed this and if its common knowledge then forget I said anything, but I found out today that you can do this:

height="{ (dropDown.height > descriptorBox.height)
? (dropDown.height + 50) : (descriptorBox.height + 50) }” />

Doesn’t look like much but its a quick and dirty way to have conditional bindings without having to use a binding class or getter/setter method to handle the logic. Call me lazy, but I think this is pretty cool.

ian AS3.0, Flex, News

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.