added some internal and protected functions for onFlatten, onAddedToStage and onRemovedFromStage; they can be used in components extending displayobject instead of adding eventlisteners (for example feathers components) and avoid creating method closures