The ability for an installed AIR application, to access and load Classes from a separate SWF that is located on the file systemI consider this to be a "plugin" architecture. Let me give you a concrete example. I am working on various AIR projects at any one time. For each I write FlexUnit tests. Because my tests are used to test my AIR applications, they need access to the AIR specific libraries. Rather than compile a unique FlexUnitRunner for each set of tests, I would like to create a single FlexUnitRunner application that allows me to load and run the tests from any of my projects.
I want to be able to have my test projects get built automatically when I change a class in FlexBuilder and then be able to hit a "refresh" button on my FlexUnitRunner application to rerun the tests with the changes.
My initial thought was that I could package my unit tests in a SWC and then have my runner unzip the SWC, pull out the library.swf, load it using RSLItem, SWFLoader or Loader. Then get amd instantiate my TestSuite from that set of tests and run it. This seemed to work in AIR 1.1 but doesn't work in AIR 1.5. The result in 1.5 is always "the Variable PreSaveProcessorTest is not defined"
My second thought was to compile a Module and load that at run time. I can load the module, but I can't figure out how to use AIR specific classes File, FileStream, etc. in the module. There is no option to "include Adobe AIR Libraries" like there is when compiling an SWC.
If I put my tests in a SWC project and reference them from my Module, the module can't use any of my classes that reference File for example. This isn't necessarily needed for my FlexUnit problem.
But if I reference the SWC project from my Module and try to get an instance of my ModuleTestSuite class, I can instantiate it. However I then get a FlexUnit error when I try to FlexUnitCore.run(...) my suite that says: Property metaData not found on ModuleTestSuite and there is no default value.
I have read many articles and posts regarding this, but none do exactly what I want:
Has anyone actually got a working example of how this kind of thing can be done in AIR 1.5?
This RSLItem method is exactly what I was doing in Klok, to allow installation of my 3rd party app connectors at runtime. However, that no longer seems to work.
If someone from Adobe can show a working example that would be really helpful. I imagine there are quite a number of people wondering how to create a "plugin" architecture.
UPDATE: I resolved the issue with the FlexUnit error but I am now back to "the Variable PreSaveProcessorTest is not defined". I think the issue is that FlexUnit is doing a getDefinitionByName() which seems to be the problem.