Skip to main content
sivacse24rep
Inspiring
February 17, 2014
Answered

Combo box

  • February 17, 2014
  • 1 reply
  • 824 views

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

This topic has been closed for replies.
Correct answer sivacse24rep

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.

1 reply

kglad
Community Expert
Community Expert
February 17, 2014

use

if(comboBox&comboBox.stage){

comboBox.parent.removeChild(comboBox);

comboBox.removeEventListener(MouseEvent.CLICK,restartTimer);

comboBox    = null;

}

sivacse24rep
sivacse24repAuthorCorrect answer
Inspiring
February 18, 2014

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.