dsrnu
asked on
How Do I Dynamically Delete DisplayObjects from Movie Clip?
Hi
So I have the code for creating a new object of a movie clip I have made called listContainer. Everything on the display object side works great, they display nicely on the screen
However, when I want to delete a certain object from the stage, how would I do this?
I tried with
interestListMC.removeChild At(#)
but it's hard to guess the numbers to deelte, since each display object produces 2 children (in my case)
is there any way to delete a certain child? by ID or something other than index? Thanks.
So I have the code for creating a new object of a movie clip I have made called listContainer. Everything on the display object side works great, they display nicely on the screen
However, when I want to delete a certain object from the stage, how would I do this?
I tried with
interestListMC.removeChild
but it's hard to guess the numbers to deelte, since each display object produces 2 children (in my case)
is there any way to delete a certain child? by ID or something other than index? Thanks.
var listContArry:MovieClip = new listContainer();
interestListMC.addChild(listContArry);
ASKER
I add the listContainer boxes dynamically, as user clicks a button
so I have code to add the listeContainer, but each listContainer is the same object name as its a for loop as in the code section
how Do I identifiy certain boxes according to their ID and delete them? I have the variable id in the obj parameter that identifies the id of the object
would I be able to append that ID onto the listContArry variable?
Thanks!
so I have code to add the listeContainer, but each listContainer is the same object name as its a for loop as in the code section
how Do I identifiy certain boxes according to their ID and delete them? I have the variable id in the obj parameter that identifies the id of the object
would I be able to append that ID onto the listContArry variable?
Thanks!
for each(var obj:Object in interestObjArry) {
var listContArry:MovieClip = new listContainer();
interestListMC.addChild(listContArry);
listContArry.x = 25;
listContArry.y = pos_y;
pos_y += 140;
listContArry.idText.text = obj.id;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you! works great
ASKER
Thanks!
removeChild(getChildByName
if you added dynamically with actionscript then use the variable name
interestListMC.removeChild