[Flashcoders] Testing before removing a child

2009-11-18 Thread Alan Neilsen
I am using loader_clip.removeChild(ldr); to remove child objects from my loader clip, and I want to test if a child object is there before removing it. I thought it would be something like if (loader_clip.child !=0) { // or !=, or !=null, or ==true, or something like that

Re: [Flashcoders] Testing before removing a child

2009-11-18 Thread Gregory Boland
try .numChildren property On Wed, Nov 18, 2009 at 4:48 PM, Alan Neilsen aneil...@gotafe.vic.edu.auwrote: I am using loader_clip.removeChild(ldr); to remove child objects from my loader clip, and I want to test if a child object is there before removing it. I thought it would be something like

Re: [Flashcoders] Testing before removing a child

2009-11-18 Thread Francis Turmel
If I understand properly what you mean, the contains method is what you're looking for. if (loader_clip.contains(ldr)){ loader_clip.removeChild(ldr); } http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObjectContainer.html#contains%28%29 On Wed, Nov 18, 2009