2 Replies Latest reply on Sep 23, 2010 10:29 AM by Flex harUI

    When does partRemoved() actually get called?

    face4radio Level 1

      partAdded() and partRemoved() are great additions to the Spark architecture, allowing deferred assignment of event listeners to skin parts until they are actually needed.  It's clear enough that partAdded() gets called when a skin part is instantiated.  Is partRemoved() then called when the part is removed from the display list, or only when the part is made eligible for garbage collection?  That seems to be the case, but I'd love to have it officially confirmed or corrected.

       

      For exampe, if a skin part is part of stateOne but not part of stateTwo, does the skin part have to be destroyed (itemDestructionPolicy="auto") in order for partRemoved() to be called for that part?  If so, what is the recommended approach for handling addition to and removal from the stage -- addding ADDED_TO_STAGE and REMOVED_FROM_STAGE event handlers during partAdded() execution?  That seems a little wonky, but I've not found a better approach.

       

      Thanks,

      - face