for each (child:someClass) in MovieClip? doesn't work!
hello,
In short:
How can I remove all children that are instances of a given class?
I've tried the following:
Code:
for each (var obj:InfoBox in infoPanel)
{
infoPanel.removeChild(obj);
}
if i do that i get this error:
Code:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@4304f821 to InfoBox
however, if i use MovieClip instead of InfoBox (for each (var obj:MovieClip in infoPanel), it works well and it removes all movieclips.
and if i trace infoPanel.getChildAt(i) (in a loop), i get all the objects [object InfoBox] as well as the objects MovieClips.
Why?
thanks in advance!