2 Replies Latest reply on Oct 23, 2009 1:02 PM by paul.williams

    check box in flex

    RosieGp Level 1

      I have a check box and a label related with it which I want to appear when the user checks the check box....

       

       

       

      <mx:Label

       

      x="10" y="76" text="Information" fontWeight="bold" fontSize="11"/>

       

       

      <mx:Label x="366" y="76" text="Record - New/Existing" fontWeight="bold" fontSize="11"/>

       

       

      <mx:Label x="578" y="76" text="Date Recorded - New" fontWeight="bold" fontSize="11"/>

       

       

      <mx:Label x="10" y="105" text="New Record Description" fontSize="11" fontWeight="bold"/>

       

       

       

      <mx:CheckBox

       

      x="10" y="495" label="New Record" fontSize="11"/>

      //// This is the part which I want it to appear if user check the box...

      //From here

       

       

      <mx:Label x="10" y="200" text="List Records " fontWeight="bold" fontSize="11"/>

       

       

      <mx:Label x="10" y="227" text="Access Code Procedures" fontSize="11" fontWeight="bold"/>

       

      <mx:TextInput

       

      x="0" y="215" width="53" fontSize="11"/>

       

       

      <mx:TextInput x="0" y="245" width="53" fontSize="11"/>

       

      //Till here

       

      <mx:Label x="366" y="76" text="Record - New/Existing" fontWeight="bold" fontSize="11"/>

       

       

      <mx:Label x="578" y="76" text="Date Recorded - Existing" fontWeight="bold" fontSize="11"/>

       

       

      <mx:Label x="10" y="105" text="Existing Record Description" fontSize="11" fontWeight="bold"/>

       

       

        • 1. Re: check box in flex
          paul.williams Level 4

          A very simple approach would be to bind the visible and includeInLayout properties of your four "hideable" children to the selected property of the checkbox. To do this you will need to give your checkbox an id:

           

          <mx:CheckBox id="isNewRecord" x="10" y="495" label="New Record" fontSize="11"/>

           

          And then add the necessary bindings to your children:

           

          <mx:Label

               x="10" y="200" text="List Records" fontWeight="bold" fontSize="11"

               visible="{ isNewRecord.selected }" includeInLayout="{ isNewRecord.selected }"/>

          There are more powerful approaches such as using states. Take a look at the login example on this page:

           

          http://www.adobe.com/devnet/flex/quickstart/creating_states/

          1 person found this helpful
          • 2. Re: check box in flex
            Flex harUI Adobe Employee

            The following is the quick and dirty way.  You might want to use states instead.

             

            <mx:CheckBox id="cb"

             

            x="10" y="495" label="New Record" fontSize="11"/>

            //// This is the part which I want it to appear if user check the box...

            //From here

             

             

            <mx:Label x="10" y="200" text="List Records " fontWeight="bold" fontSize="11" visible="{cb.selected}" includeInLayout="{cb.selected"}/> 

             

             

            <mx:Label x="10" y="227" text="Access Code Procedures" fontSize="11" fontWeight="bold" visible="{cb.selected}" includeInLayout="{cb.selected"}/>

             

            <mx:TextInput

             

            x="0" y="215" width="53" fontSize="11" visible="{cb.selected}" includeInLayout="{cb.selected"}/>

             

             

            <mx:TextInput x="0" y="245" width="53" fontSize="11" visible="{cb.selected}" includeInLayout="{cb.selected"}/>

             

            //Till here

             

            Alex Harui

            Flex SDK Developer

            Adobe Systems Inc.

            Blog: http://blogs.adobe.com/aharui