Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>removeChild or removeChildAt does not actually remove an Sprite or any other DisplayObject from memory, it only removes it from the displaylist. That means if you create 1000 sprites and add them to the stage (displaylist), and then use removeChild on all 1000 sprites they could still exist in memory forever.</p> <p>To remove it from memory, it should be set to null at all referencing objects.</p> <p>If you really want to remove it, just null it and check these things:</p> <ul> <li>Remove it from the displaylist using removeChild or removeChildAt</li> <li>Remove all eventListeners that are attached to the clip.</li> <li>If you used a reference in an Array, Vector, Dictionary or any other object, remove it from the object, set it to null or splice it using Array.splice()</li> <li>Set the object = null</li> </ul> <p>You could use a solution like an <a href="http://code.google.com/p/stroep/source/browse/#svn/trunk/flashsources/flashflowfactory%20framework/nl/stroep/flashflowfactory/display" rel="noreferrer">EventManagedSprite</a> which uses an <a href="http://code.google.com/p/stroep/source/browse/#svn/trunk/flashsources/flashflowfactory%20framework/nl/stroep/flashflowfactory/utils" rel="noreferrer">EventRemover</a> to make it a bit easier to completely remove objects. This also could be helpful in bigger projects.</p> <p>If you want to re-use the sprite/object, but recycle you want to recycle the objects, you should use object pooling. More about <a href="http://lostinactionscript.com/2008/10/30/object-pooling-in-as3/" rel="noreferrer">object pooling with AS3</a>: </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload