Link to home
Start Free TrialLog in
Avatar of timbad2021
timbad2021

asked on

removeChild - Removing dynamically generated child movieclips

Ok, so if you view my project you will see that it is a drag and drop application. You will also see two buttons at the bottom (I plan on adding more), when you click on a box it will add more objects to the menu. Heres where my question comes in, the box then says remove on it, I want the items that were added by clicking on the box to be removed as well as items added to the stage when you click on that same box again, how do I do this?

Thanks
Project-EE.zip
SOLUTION
Avatar of ChristoferDutz
ChristoferDutz
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of timbad2021
timbad2021

ASKER

Thanks, that helps but could you also show me a working example?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried using the code you provided but I get the following error:
1067: Implicit coercion of a value of type String to an unrelated type flash.display:DisplayObject.

So I switched DisplayObject to a wildcard (flash.display:*). It then runs without errors, so now in order to run the function I put removeCreatedItems(); inside the btnEnable1 function but I get the following error at runtime.

ReferenceError: Error #1069: Property parent not found on Number and there is no default value.
      at DragGame/removeCreatedItems()
      at DragGame/btnEnable1()

Any ideas?
Stumped?
Well I couldn't see what your classes are, so I assumed they were all display objects. It seems some of them are simple Strings that are added to the menu. This can't work the way I did it, because Strings are no DisplayObjects and therefore have no parent property.

I'll have a deeper look at your code tomorrow as I'm totally filled with work today. Unfortunately I'm not really used to native Flash, as I do most of my ActionScript in FlashBuilder. ... But I'll have a look at it tomorrow.
K, yeah, I did do a little native flash because I'm new to OO AS3 and I couldn't get my button listeners/functions to play nice inside the document class. Anyway I'll just wait to see what you find tomorrow. Thanks!
Do you think you'll have a chance to get to this today as I am stuck on this project until I get past this issue. Would really appreciate your help. Thanks, Tim
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks