Search code examples
apache-flexactionscript-3singletonimplementationextend

Difficulty copying/extending singleton manager class


I want to extend or copy the PopUpManager class to add the ability to keep track of the number of windows. I just want to add a simple windowCount++ when a window is added and windoCount-- when it's removed.

the problem is PopUpManager is a Singleton class... I wasn't able to make it work properly by extending it. And now I have tried to copy the code from the PopUpManager.as file and just add my variable to the end of its functions. It doesn't seem to be working though since it says my properties are undefined even though they are declared above the constructor.

I am thinking I would have to make a copy of the PopUpManagerImpl.as since that's wehre it seems much of the business resides (PopUpManagerImpl extends EventDispatcher implements IPopUpManager) would that allow me to have access to the variable? and should I ignore the manager and just put it in the implementation class?


Solution

  • here is a link about Using the Flex Singleton register, which helped me out when finding myself in the same situation.

    I hope you can inspire from that too.