5 Replies Latest reply on Jul 14, 2011 6:46 AM by Venkatesan Balasubramanian

    how to initialize checkbox in flex4

    Venkatesan Balasubramanian Level 1

      hi friends,

       

                   if checkbox selected false means one function will run and checkbox selected true means another function will run, i want to use if and else condition for this.when i try this i am facting error like this how i will rectify,please help

       

       

      var chkIncrSlab:Boolean;

       

      if(chkIncrSlab.selected = false)----> error- Access of possibly undefined property selected through a reference with static type Boolean.

        • 1. Re: how to initialize checkbox in flex4
          _spoboyle Level 4

          Firstly, '=' is an assignment operator, use '==' for comparisons.

           

          Secondly, chkIncrSlab is a Boolean and so does not have a property called selected

           

          so chkIncrSlab.selected will fail

           

          I am not 100% sure but, I think you are after something like this?

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                      xmlns:s="library://ns.adobe.com/flex/spark" 
                                      xmlns:mx="library://ns.adobe.com/flex/mx"
                                      minWidth="955" minHeight="600">
          
               <fx:Script>
                    <![CDATA[
                         
          
                         protected function checkBox_changeHandler(event:Event):void
                         {
                              if (checkBox.selected)
                              {
                                   sayHello();
                              }
                              else
                              {
                                   sayGoodbye();
                              }
                         }
                         
                         private function sayHello():void
                         {
                              label.text = "hello";
                         }
                         
                         private function sayGoodbye():void
                         {
                              label.text = "good bye";
                         }
          
                    ]]>
               </fx:Script>
               
               <s:VGroup horizontalCenter="0" verticalCenter="0">
                    <s:CheckBox id="checkBox"
                                   label="test"
                                   change="checkBox_changeHandler(event)"/>
                    <s:Label id="label"/>
               </s:VGroup>
               
          </s:WindowedApplication>
          
          • 2. Re: how to initialize checkbox in flex4
            Venkatesan Balasubramanian Level 1

            first of all thanks for the quick replay.

             

            i am using 2windows.i am using check box in first form.in that form i am using textinput for userid and 2 more textinput used for some value and one save button. 2nd window i am using textinput  for userid and one data grid,navigation button

             

            while i am clicking save button that data will be store in db, In second window using plan id i need to retrive the values which i given in the text in put fields in the first window when i am clicking navigation buttion.that values wil display in datagrids first line then how i will edit second line,3rdline.4thline etc...

             

             

            thanks in advance,

             

            B.venkatesan

            • 3. Re: how to initialize checkbox in flex4
              _spoboyle Level 4

              did my first post solve your orginal problem?

               

              the description isn't very clear, best thing to do is post some code that illustrates your issue.

               

              unforunately I have never worked with datagrids so am unlikely to be able to help

              • 5. Re: how to initialize checkbox in flex4
                Venkatesan Balasubramanian Level 1

                i got some ideas form ur first post,bt what i told in my second post thats my recuirement.can u help me to get that?

                 

                 

                Thanks

                 

                B.venkatesan