April 21, 2009 0

REMOVE and REMOVE_FROM_STAGE difference

By in Action Script

Short reminder: Event.REMOVE does bubble;
Event.REMOVE_FROM_STAGE does not.

So when implementing a listener don’t forget to check the target:

function onRemove(anEvent: Event)
{
  if (anEvent.target == this)
  {
    // clean up
  }
}

Tags: