Is it possible that you are not removing from the container you added
to?  Is this on the first reset or subsequent?  If not the first, then
the prob might be that you aren't resetting the labelCollection.

 

FWIW, it is probably  overkill to use AC instead of an array here.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of donvoltz
Sent: Tuesday, September 18, 2007 2:17 PM
To: [email protected]
Subject: [flexcoders] Re: Removing children when they have no id

 

Thanks to all for the help but I am still seeing some issues I do not
understand

I have done the following

private var labelCollection:ArrayCollection = new ArrayCollection();
//place to hold the label instances

private function makeLabelHandler(event:ResultEvent):void {

...process data and construct new labels

labelCollection.addItem(newLabel);
this.addChild(newLabel);
}
}

On a button click I call the following function

private function resetCallLocations():void {

for each (var someLabel:Label in labelCollection){

removeChild(ff);
}

This returns the following error

ArgumentError: Error #2025: The supplied DisplayObject must be a child
of the caller.

Am I setting this up correctly or is this not the way to instantiate
many labels

Thanks for the help

Don

 

Reply via email to