![]() ![]() In the loaded module, call the allowDomain() method so that it can communicate with the loader.ModuleLoader Group GroupBase UIComponent FlexSprite Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object.Load the cross-domain file on the remote server in the preinitialize event handler of your loading application.In the cross-domain file of the remote server where your module is, add an entry that specifies the server on which the loading application is running.So, specify the target domain in the preinitialize event handler of your application to ensure that the application is set up before the module is loaded. In your loading application, you must call the allowDomain() method and specify the target domain from which you load a module.To load a module from one server into an application running on a different server, you must establish a trust between the module and the application that loads it. Otherwise, the object might be garbage collected and the associated event listeners might never be invoked. Those modules can load other modules, and so on.īe sure to define the module instance outside of a function, so that it is not in the function's local scope. MXML-based modules can load other modules. The following example shell application loads the ColumnChartModule.swf file and then adds it to the display list so that it appears when the application starts: If you do not specify either of these, then the module is loaded into a new child domain. The IModuleInfo class's load() method optionally takes an ApplicationDomain and a SecurityDomain as arguments. Finally, you use the factory property of the interface to call the create() method and cast the return value as the module's class. You then call the interface's load() method. To use the ModuleManager to load a module in ActionScript, you first get a reference to the module's IModuleInfo interface by using the ModuleManager getModule() method. This technique is less abstract than using the tag, but it does provide you with greater control over how and when the module is loaded. You can use the ModuleManager class to load the module. Using the ModuleManager class to load modules For more information, see Module domains. The solution is to promote the class definition to the main application domain so that all modules can use the class. Because they are in sibling application domains, the module that loaded the class definition first can use that class, but other modules will experience errors when they try to use that class. A common issue that occurs when using multiple modules is that the modules own class definitions that other modules want to use. ![]() When two classes of the same name but different implementations are loaded, the first one loaded is the one that is used. When you load a module, Flex ensures that there is only one copy of a module loaded, no matter how many times you call the load() method for that module. The following example loads and unloads the module when you click the button: These methods take no parameters the ModuleLoader loads or unloads the module that matches the value of the current url property. You can also use the ModuleLoader API to load and unload modules with the loadModule() and unloadModule() methods. The following example loads the module when the application first starts: You set the value of the url property to point to the location of the module's SWF file. The easiest way to do this in an MXML application is to use the tag. You can use the ModuleLoader class to load module in an application or other module. Using the ModuleLoader class to load modules ![]() When you're using modules in an AIR application, the module SWF must be located in the same directory as the main application SWF or one of its subdirectories. For more information, see Using the ModuleManager class to load modules. ModuleManager - The ModuleManager class provides a lower-level API for handling modules than the ModuleLoader class does.For more information, see Using the ModuleLoader class to load modules. ModuleLoader - The ModuleLoader class provides the highest-level API for handling modules.There are several techniques you can use to load and unload modules in your Flex applications. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |