4 Replies Latest reply on Mar 2, 2009 6:43 AM by Newsgroup_User

    if condition in Flex?

    rahimhaji Level 1
      Dear Friends,

      iam trying to crate a contineous check boxes using repeater command, and connecting an array as data provider.

      <mx:Repeater id="rp" dataProvider="{ac}" startingIndex="1">

      <mx:CheckBox id="chk" label="label1" color="0xffffff" height="20" width="200"/>

      </mx:Repeater>

      it is creating the checkboxes fine, but i need to check if the data is empty, then it should skip the mx:checkbox command it should not create the checkbox.

      is there any way to do this? pls help me i got struct up..

      Thanks and Regards,
      Syed Abdul Rahim
        • 1. Re: if condition in Flex?
          markuspedro Level 1
          var ad:Array=new Array;
          if(ad.length==null){

          //do something
          }else{

          //do something
          }

          Bye
          • 2. Re: if condition in Flex?
            Madhav Subedi Level 4
            try it:
            <mx:Repeater id="rp" dataProvider="{ac}" startingIndex="1">
            <mx:CheckBox id="chk" label="label1" color="0xffffff" height="20" width="200"
            visible="{yourcondition?true:false}" includeInLayout="{yourcondition?true:false}"
            />
            </mx:Repeater>
            • 3. Re: if condition in Flex?
              rahimhaji Level 1
              Dear Mr.Madhav Subedi,

              Thanks a lot.. . this include in layout very useful to me.. thks a lot working fine...

              Thanks and Regards,
              Syed Abdul Rahim
              • 4. Re: if condition in Flex?
                Level 7

                "rahimhaji" <webforumsuser@macromedia.com> wrote in message
                news:gog1uk$hdg$1@forums.macromedia.com...
                > Dear Friends,
                >
                > iam trying to crate a contineous check boxes using repeater command, and
                > connecting an array as data provider.
                >
                > <mx:Repeater id="rp" dataProvider="{ac}" startingIndex="1">
                >
                > <mx:CheckBox id="chk" label="label1" color="0xffffff" height="20"
                > width="200"/>
                >
                > </mx:Repeater>
                >
                > it is creating the checkboxes fine, but i need to check if the data is
                > empty,
                > then it should skip the mx:checkbox command it should not create the
                > checkbox.
                >
                > is there any way to do this? pls help me i got struct up..

                Filter your ArrayCollection to not show empty items.