actionscript 3 - Create Plugins in Flex - loading nested SWF files -


I am trying to implement a plugin system for my application, and it is a time devil The SWF file was dynamically received

  1. The main application loads the shell ...
  2. ----- Auto loading, additional SWF Load files.

    ---- + Application load ...

  3. ----------------- + plugin

I have no problem applying # 1 to load app # 1

However, I can try that I can # 2 to load and instantize app # 2 can not receive

I have tried various permutations using the module manager, but it is the closest I get. When the onLoadComplete method is implemented, I can see that the SWF is loaded, although the factory always receives zero.

The interesting thing is that when I remove it in my application, it works fine This problem is starting with the fact that I am loading the plugin from a SWF which is loaded dynamically Was happening.

I believe this is due to ApplicationDomain , but I can not head or tail it. I tried to specify currentDomain , new applicationman (application currentDomain) and new ApplicationDomain () without success

In addition, it is important to keep in mind that since I can not refer to a difficult reference of the Fu class in any application since its nature, we have not been able to know beyond what time they will be involved.

Around Googlin, this is a quite known problem, but I have not found any clear solutions yet.

 . . AssetModule = ModuleManager.getModule ("Foo.swf"); AssetModule.addEventListener (ModuleEvent.READY, onLoadComplete); AssetModule.addEventListener (ModuleEvent.ERROR, onLoadError); AssetModule.load (); . . . Private var _pluginInstance: plugin; Private function onLoadComplete (event: event): zero {trace ("module load"); _pluginInstance = assetModule.factory.create () as plugin; If (_pluginInstance) _pluginInstance.startup (); Other Alerts Show ("Unable to Instantly Modify"); } Private function onload error (Event: Event): zero {alert.show ("error"); } My plugin looks like this: package {import mx.collections.ArrayCollection; Import mx.modules.ModuleBase; Modulesbase public function startup in public category plugins (): Zero {} extends. . }  

and

  package {import plugin; Import mx.modules.ModuleBase; The public class extends the Fu plugin {public function Fu () (trace ("Fu constructor encoded"); } Override public function startup (): zero {trace ("start afu"); }. . } 

The methods were called upon (not cast).

var MyPlugin: Object = getPlugin (); MyPlugin.doPluginFunc ();

Normally there can be no problem between system / flex classes. Do not know that it will help keep the plugin as a runtime library?


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -