Ralph,

I would be interesting if we could track "actionscript-memory"
I've run into another interesting related error, that i haven't confirmed 100% but i'll explain my current conclusion.

i have 2 childs, index's 0 and 1.
0 is selected, then i switch selectedIndex to 1.
Next i remove 0. When i do that i get an out of bounds error and in the debugger i notice that selectedIndex is still set to 1. Shouldn't it have updated to 0 since I only now have 1 child?

Anyway i'm digging through the Container Class to understand the actual behavior now.

Bjorn

On 24/11/2006, at 10:29 AM, Ralph Hauwert wrote:

Bjorn,

Actually the docs don't lie about that. The removal of a child of the displaylist will free up the memory it used on the diplaylist in the FlashAPI, but that's not "Actionscript-memory". (I wish I knew adobe's terms on this, I know they have them ;-) ). Performance gets increased, because the object doesn't need to be drawn no more. Since the drawing of everything is the bottleneck compared to the AVM2, that's actually more true then I'd like ;-)
Ahh, Flash 10, give us hardware support ;-)

Ralph.

On 11/24/06, Bjorn Schultheiss <[EMAIL PROTECTED] > wrote:
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.childDescri ptors [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




--
Ralph Hauwert
FlashCoder



Reply via email to