Thanks Ralph,

The behavior of the remove/addChild methods are consistent I guess.
I only became perplexed on this issue after the documentation read that, using removeChild() within the Container would reduce memory usage and improve performance.
Seems like a case for ViewStack.removeChildAndAllReferences()  :)

Bjorn

On 24/11/2006, at 6:32 AM, Ralph Hauwert wrote:

removeChildAt() will only remove the specified object from the displaylist, it won't destroy the object. Flex, by design keeps references to objects in containers. You'll have to remove all references to a specfic object to actually have it removed. We've run into some problems with this; this was related to states, though, and this is also something which is by design.

On 11/23/06, bjorn.schultheiss <[EMAIL PROTECTED]> wrote:
Hi,

How come after calling removeChildAt(selectedIndex) within a viewstack
the child object still remains?

I've run basic tests to try get this working but no win.

I have a ViewStack based on this;
import mx.containers.ViewStack;
public class ExtVS extends ViewStack
{
// my new selectedIndex()
public function set updateSelectedIndex(index:Number):void
{
this.createComponentFromDescriptor(this.childDescriptors [index],false);
this.validateNow();
if (index > 0)
removeChildAt(selectedIndex);
}
}

And i've set it's creationPolicy="none".

I have 3 children. When i start the app in the debugger my children
look like this in the variables panel;
c1 = "childs.MyPanel"
c2 = null
c3 = null

By the time a proceed through each stack my debugger variables say;
c1 = "childs.MyPanel"
c2 = "childs.MyBox"
c3 = "childs.MyCanvas"

shouldn't it be
c1 = null
c2 = null
c3 = "childs.MyCanvas"

Also i am tracking totalMemory usage and i am receiving no benefits
compared to when i was not using removeChild()

Thanks,
Bjorn





--
Ralph Hauwert
FlashCoder



Reply via email to