TypeError: Error #1034: Type Coercion failed: cannot convert mx.managers::HistoryManagerImpl@f22eee1

Recently discovered a flex modules loaded trigger dragManager error, in the main application inside put a moduleLoader to load module, put the two buttons to control the repeated load, according to the first load module, a button press another button to uninstall the module, using the moduleLoader load method, loading unloading using unloadModule () method, module placed in a datagrid, found in the testing process, when to reload the module, Is also carried out a unloadModule method and then press the first button to reload the module, if this time to click on any one line will appear inside the datagrid:
TypeError: Error # 1034: the Type Coercion failed: always convert.
mx managers: : DragManagerImpl@12631a61 converts to the error mx.managers.idragmanager
. After a long search on Google, I finally found the solution on a foreign forum. It is as simple as adding
import mx.managers.DragManager into the main application.
private var dragManager: dragManager;
these two sentences will solve the problem. As for why can appear such circumstance, find an explanation for the others on the Internet, the following is from Google a flex discussion group of other people’s answer (HTTP:// groups.google.com/group/riadev/tree/browse_frm/month/2007-05/5eeebf64e4926c45?rnum=11& _done = % 2 fgroup % 2 friadev % 2 fbrowse_frm % 2 fmonth % 2 f2007-05% 3 f)
QUOTE:

This is Shared code for Module,

this problem tends to occur when managers are used in a Module (such as PopUpManager, DragManager, HistoryManager),

manager’s methods are static methods, and a singleton of this manager interface is created throughout the application,

but a module USES this singleton only in its own Application domain, when multiple modules use the same singleton and main
This empty object reference problem occurs when the
application is not in use: a module that first introduces a manager cannot follow the singleton of the manager interface

is Shared by other modules. When other modules call the method of the Manager, the application will not create the instance of the Manager interface any more, so this module cannot refer to the instance of the Manager interface, which causes the problem of empty object reference. You can refer to Flex source code.

Accordion and TabNavigator’s historyManagementEnabled = by default

true; And ViewStack’s historyManagementEnabled = false;

so be aware of HistoryManager’s Shared code issues when using TabNavigator and Accordion. This problem also occurs when only one module USES HistoryManager and that module is loaded after uninstalling, indicating that the second load is equivalent to a new module.

a solution:

introduces the relevant manager in the main application by declaring the reference of the manager in the main application, as follows:

import mx.managers.HistoryManager;

var historyManager:HistoryManager;

other managers are similar.

can also load the Shared code into the main application domain as a module, which can be explained in detail by referring to Alex

Harui PPT:

Speak http://blogs.adobe.com/aharui/presentations/ below the presentation about the module, very detailed.

Read More: