2 Replies Latest reply on Jul 28, 2009 1:03 PM by Gregory Lafrance

    <mx:if>?

    SushiSnacks

      I want to display a mx tag button or not based on a value. Is there a way to say this:

       

      <mx:if id gt 4> /*if variable id greater than 4*/

          <mx:Button label="View Bug" click="goToBugs(data.id)" />

      </mx:if>

       

      thanks.

        • 1. Re: <mx:if>?
          _Natasha_ Level 4

          Hi,

           

          As a variant:

          <mx:Button label="View Bug" click="goToBugs(data.id)" visible="{id &gt; 4}"/>

          • 2. Re: <mx:if>?
            Gregory Lafrance Level 6

            Actually, you'll need to set includeInLayout as well:

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
              <mx:Script>
                <![CDATA[
                  [Bindable] private var a:uint = 5;
                ]]>
              </mx:Script>
              <mx:Button label="> 4" visible="{a &gt; 4}" includeInLayout="{a &gt; 4}"/>
              <mx:Button label="> 6" visible="{a &gt; 6}" includeInLayout="{a &gt; 6}"/>
            </mx:Application>
            

             

            If this post answered your question or helped, please mark it as such.