I often have an function / action that is performed on a mouse event (say, MouseEvent.CLICK) that has to be moved to:
- happen inside of an animation (at a given frame label)
- happen at an event (say, Event.COMPLETE)
- happen when another item is added to the stage or removed from the stage
What is the best OOP way to encapsulate such activities so that I am not constantly rewriting my code?
By the way, I should also mention that this function also being moved from one display object to another, not the just event that it is listening for...