Groups | Blog | Home
all groups > flash actionscript > october 2005 >

flash actionscript : Destroying a dynamic combo box control


msanders_sscd
10/19/2005 10:10:14 PM
I am creating an application that creates many combo box components based on a
database table. I can create and use the dynamic combo boxes without a
problem. The problem is when I want to tell the application to creat more
combo boxes, again based off of a database table, I can not destroy the
existing combo boxes and create new ones. I have seen several examples of
creating and using the combo box component dynamically, but I have not seen
amything about destorying an existing dynamically create combo box component.
What is wierd is that I create dynamic labels, and text inputs as well as the
como boxes, and I can successfully destory the labels and text inputs but not
the combo boxes. Here is my snippet of code to try to destroy and create the
combo boxes. Any response would be awesome. Thanks in advance.


var x:Number = 0;
while(typeof(filterArray.getItemAt(x).RECID) != "undefined") {

tiOperator = "OPERATOR_" + x;

//
// Create the operators combo box
//
trace("");
// Just see if I get an undefined in the trace or
not
trace("Before: " + _root.application.main.search[tiOperator]);
_root.application.main.search.destroyObject(tiOperator);
trace("After: " + _root.application.main.search[tiOperator]);
trace("");
_root.application.main.search[tiOperator].addItem({data:"=", label:"="});
_root.application.main.search[tiOperator].addItem({data:"!=", label:"!="});
_root.application.main.search[tiOperator].addItem({data:">", label:">"});
_root.application.main.search[tiOperator].addItem({data:"<", label:"<"});
_root.application.main.search[tiOperator].setSize(40, 22);
_root.application.main.search[tiOperator].move(120,curPos);



dev_BFD
12/22/2005 10:50:47 AM
hello,
when you want to destroy object with destroyObject function, you must specify
the name of your component to be destroyed, so you wrote that :
_root.application.main.search.destroyObject(tiOperator);
replace with
_root.application.main.search.destroyObject(tiOperator._name);
AddThis Social Bookmark Button