Hey, no fair piling on a thread. Start your own :-)
This error occurs for two reasons: One is that somehow, the DragManager or DragManagerImpl is not linked into the movie. The other, and more common reason is that more than one module is using the DragManager, but the main application does not.. Modules operate in their own application domain, and thus cannot share singletons unless that singleton is loaded by the parent application domain. The simple solution is to link the DragManager into the main application by putting something like this in a script block import mx.managers.DragManager; var dm:DragManager; This fattens your application a little. More complex solutions involve loading the DragManager into the main application's application domain. The above is true for all managers handled by Singleton and lots of other shared classes in Flex as well. -Alex ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Bjorn Schultheiss Sent: Thursday, January 11, 2007 5:28 PM To: [email protected] Subject: Re: [flexcomponents] Singleton :: Register problems I have a bug in my app that i have not been able to get around. At runtime when i test a specific module that contains slightly modified flex 2 controls I'm always getting a 'cannot reference null object' error, related to DragManager.isDragging(). After attempting to sniff out the problem we assume it is that "mx.managers::IDragManager" is never getting registered and therefore the singleton call, private static var impl:IDragManager = Singleton.getInstance("mx.managers::IDragManager") as IDragManager; is failing. We've found it difficult to fix since most of the related classes contain the [ExcludeClass] metatag and we are looking for pointers on how to get around this issue. Thanks, Bjorn On 12/01/2007, at 8:52 AM, Alex Harui wrote: You can register anytime before you need to ask for the singleton. Since our managers get used early in startup, we register them as early as possible. You might be able to wait longer, even as late as creationComplete. In some apps, the popup manager is loaded in a module that is loaded way after the app started. We register interfaces instead of classes for version control. If a module in an application requires an older version of the framework, it will live in its own application domain and thus not share the same singleton as the main app. What we promise is that the interfaces will never change, and the interfaces are put in a bootstrap app domain. Then when you ask for the singleton, you can share it across app domains. -Alex ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Schmalle Sent: Thursday, January 11, 2007 1:38 PM To: [email protected] Subject: [flexcomponents] Singleton :: Where to register with classMap Hi, I have managers I am implementing singletons with. I am trying to stick to the singleton pattern. I see that yor singletons are registered in the systemManager frame 2 handler. I also see that you are not using registerInitCallbacks() anymore. So the question is... Where do I put my line of code that registers the implementation class with the Singleton class map? IE you have Singleton.registerClass("mx.managers::ICursorManager ", Class(getDefinitionByName("mx.managers::CursorManagerImpl"))); I want Singleton.registerClass("com.teotiGraphix.manager::IMoveManager", Class(getDefinitionByName("com.teotiGraphix.manager::MoveMangerImpl "))); Also, why do you use the interface name when registering the class, is that so others can override you implementation? (with the same register call)... This is the first time I actually thought about it this way. ;-) Peace, Mike PS I have been kind holding back on releasing components thus far because I wanted my managers piped into this new algorithm. -- Teoti Graphix http://www.teotigra <http://www.teotigraphix.com> phix.com Blog - Flex2Components http://www.flex2com <http://www.flex2components.com> ponents.com You can find more by solving the problem then by 'asking the question'.
