Registered User
Registered User

Reputation: 9026

DataBinding help in Flex 4

I managed to make the enabled thing work.

<s:Button x="388" y="219" width="180" height="40"
          label="Generate Code" fontWeight="bold"
          enabled="{(mbUniqueID.text!='')}" />

But I'm having trouble adding two dependencies to the button being enabled. How do I make this button enabled only if mbUniqueID.text and mbWinContent.text is not empty. I want to do this via DataBinding. I can do it without any problems via AS3 but I wanted that approach. I have successfully made the mbUniqueID.text DataBinding work. I just need to know how to make it dependent on two factors instead of just one.

Upvotes: 0

Views: 212

Answers (1)

Adnan
Adnan

Reputation: 26360

You can use this:

   <s:Button x="388" y="219" width="180" height="40"
      label="Generate Code" fontWeight="bold"
      enabled="{mbUniqueID.text !='' ? mbWinContent.text != '' ? true : false : false  }"
     />

It is not the best example but it will work.

How it works (ternary operator):

variable = condition ? value if true : value if false

Upvotes: 1

Related Questions