6 Replies Latest reply on Jan 5, 2010 10:56 PM by LaVengeance

    Disable the background except textfield

    imranv10 Level 1

      Hi  My requirement is to disable background but I can edit 4 textfields at the same  time. If I disable the Application.application.enabled=false and then try to  enable textfield it is not working. Is there any way through which I can achieve  my target?
      Thanks
      Imran

        • 1. Re: Disable the background except textfield
          LaVengeance Level 1

          You can do something like this:

           

          {code}

           

          var a:Array = application.getChildren();
                     
                      for(var i:int = 0; i<a.length ; i++){
                         
                          var obj:Object = a[i];
                         
                          if(obj.id != "id1" && obj.id != "id2" && obj.id != "id3" && obj.id != "id4"){
                             
                              obj.enabled = false;
                          }
                         
                      }
                      }

           

          {code}

           

           

          replace id1, id2, id3 and id4 with the IDs of your four text fields, hence all the components except the 4 will be disabled.

           

          Cheers

          • 2. Re: Disable the background except textfield
            imranv10 Level 1

            Thanks for the reply

            But my problme is slight different

             

            In my default mxml file, I have put one component called BubbleContainer whose id id "bbl"

            And this component contains the textfields

            {code}

             

            package component

            {

             

            // import statements

             

            public class BubbleContainer extends UIComponent

            {

                 -------

                 public var txtRadial1 : TextInput = new TextInput();

                 public var txtRadial2 : TextInput = new TextInput();

                 public var txtRadial3 : TextInput = new TextInput();

             

             

                 -----

             

            }

            }

             

             

            // mxml file

             

            ---------

             

            <mx:HBox id="hbxMain" width="100%" height="100%" verticalGap="0" horizontalGap="0">

            <mx:HBox id="hbxBubble" width="100%" height="100%" mouseMove="{mouseMoveOnBbl(event);}"  verticalGap="0" horizontalGap="0">

            <component:BubbleContainer creationComplete="{setOriginalSize();}" mouseMove="{mouseMoveOnBbl(event);}"

            resize="{ reload();  }"

            id="bbl" width="100%" height="100%"  keyUp="{application_onKeyUp(event)}"  />

            </mx:HBox>

             

            -----------

             

            {code}

             

            Any help will be appreciated

             

            Thanks

            Imran

            • 3. Re: Disable the background except textfield
              LaVengeance Level 1

              can't you enable your entire component ( bbl ) ? try doing this :

               

               

              {code}

               

              var a:Array = application.getChildren();
                         
                          for(var i:int = 0; i<a.length ; i++){
                             
                              var obj:Object = a[i];
                             
                              if(obj.id != "bbl"){
                                 
                                  obj.enabled = false;
                              }
                             
                          }
                          }

               

              {code}

               

               

              If your requirement is different , please be more specific as to exactly which items you'd want to diable and post the entire code here, HTH ..

               

              Cheers

              • 4. Re: Disable the background except textfield
                Umal Kumar Adobe Employee

                Can you please provide some sample application so that i can try it on my end and suggest some resolution? Also as per the request i can understand that you want everything to be disabled except the text fields. Can you clarify on this a little bit more?

                 

                UKB

                • 5. Re: Disable the background except textfield
                  imranv10 Level 1

                  I can disable bbl component. But that will disable text fields as well.

                   

                  bbl component which is included in mxml file contains sprite, circle and text fields.

                  I want to disable everything on the screen except these text fields

                  If I will disable bbl component then it will disable circle and text fields and all children of bbl.

                  But I want to enable text fields.

                   

                  I hope this will clear the air.

                   

                  Thanks

                  Imran

                  • 6. Re: Disable the background except textfield
                    LaVengeance Level 1

                    create a public function in the bbl

                    component which disables all the child components except for the 4 text fields... call this function once you disable all components of your applicaiton except bbl..

                     

                    something like this :


                    {code}

                     

                    var a:Array = application.getChildren();
                               
                                for(var i:int = 0; i<a.length ; i++){
                                   
                                    var obj:Object = a[i];
                                   
                                    if(obj.id != "bbl"){
                                       
                                        obj.enabled = false;
                                    }
                                   
                                }

                     

                     

                              bbl.disableComponents();     // write this public method inside the bbl component class which will disable all children except the 4

                                                                           // text fields         
                         

                     

                    {code}