Modules and DragManager bug in Flex 3

In my last RIA project based on Flex 3, I find a bug working with modules that I’d like to sharing in this blog.

I create a dashboard where 4 custom components, that extend Panel component, load in a ModuleLoader differents sections.
In those sections there are components based on List component and when I run my project I’ve this kind of error:

TypeError: Error #1034: Type Coercion failed: cannot convert mx.managers::DragManagerImpl@21ef6df9 to mx.managers.IDragManager.

Surfing on web I don’t find anything about this kind of problem, finally on JIRA Adobe Flex bugs, I find it!
You can find workaround on JIRA ticket, it’s so easy to solve it, you only create a new instance of DragManager in your Default Application and everything works well.
This bug is created because you have more instance of DragManager in this sample, but DragManager in Flex framework is used like a Singleton so only one instance per time.
Each module has a List component that use DragManager when you have in the same application 2 or more modules you must put in Default Application file a DragManager instance and that’s it!
I think could be useful for anybody in the same situation.

Advertisements