2 Replies Latest reply: Feb 17, 2014 9:07 PM by sivacse24rep RSS

    Combo box

    sivacse24rep Community Member

      Hi,

       

      I am using flash cs 5.5. In my demo i crate a xml list .. it contain set of questions.I loaded all of them into combo box. When i finishe answer the question i want to remove the components for the gc. I am albe to remove the Combobox on normal state. But when there is the dropdown menu when i try to remove the component...the list remines there visible.I am not able to remove that.

       

      code are:

       

      //while(comboBox.numChildren>0)

           //comboBox.removeChildAt(0)      // no use

       

      trace(comboBox,"----")      // output [object ComboBox]

      comboBox.close();            // output error

      trace(comboBox,"***")      // this line not at all printing.

      comboBox.removeEventListener(MouseEvent.CLICK,restartTimer);

      comboBox    = null;

       

       

      Error msg:

      TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at fl.controls::ComboBox/close()

          at com.sample.elements.components::ComboBoxElement/dispose()

       

      how to solve the issue?

       

      Thanks,

      Siva

        • 1. Re: Combo box
          kglad CommunityMVP

          use

           

           

           

           

          if(comboBox&comboBox.stage){

          comboBox.parent.removeChild(comboBox);

          comboBox.removeEventListener(MouseEvent.CLICK,restartTimer);

          comboBox    = null;

          }

           

          • 2. Re: Combo box
            sivacse24rep Community Member

            Hi Kglad,

             

            I tryed it.It also didnt solve the issue.But thanks for the input.I got the issue now....

             

            What happend on my case is i added the combobox on a parent movieclip.

            First I attempt to remove the parent moveclip from stage then i try to close the combo box. Thats the issue.

             

            But now i changed the coding like first to close the combo box and removing the parent then. Its works now.

             

            Thanks for the replay.