5 Replies Latest reply on Jun 23, 2009 12:44 AM by EgorKDie

    How can I have conditional percentage in MXML?

    apmyhr Level 1

      I love the fact that you can set a components width or height to a percentage of its parent container.


      <mx:Button height="100%" />


      What I would like to do is have a conditional percentage based on some bindable boolean


      [Bindable] public var switch:Boolean = true;


      <mx:Button height="{switch ? '100%' : '20%'}" />


      Unfortunately I get an error saying that I can't use a string in place of a number.  I also tried this syntax and it still wont work,


      <mx:Button height="{switch ? 100% : 20%}" />


      Any suggestions?  Is this even possible?  Thanks.