It is easier for me to visualize cores when they are completely separate SWF files. The separate SWF approach also makes pieces of the program more modular and allows different development teams to focus on their piece without the clutter of the other pieces.
I have taken Chandima's Move the Cheese (link
) example and split it into two separate projects and changed the names of folders to make everything easier to examine.
- A separate project for the rat
- A separate project for the application
I have prepared a zip file for your download (link
) of all project files used in the examples below.
Here we have the folder structure and swf locations of the projects where everything is working well:Limitation #1:
Both swf files must reside in the same folder. rat.swf cannot be loaded from a separate domain. If rat.swf is loaded from a separate domain, I get a Type Coercion failure at runtime.
TypeError: Error #1034: Type Coercion failed: cannot convert Rat@140a791 to interfaces.IActor.
Please note: You will find that I added Security.allowDomain("*"); inside of the Rat constructor because I thought that could have been the root of the problem, but the runtime error is the same. Adding a trace inside of the constructor will confirm that it is executed before the type coercion failure happens.Limitation #2:
The interface files must be found in the exact same package structure in both app and rat for it to work. If the package structure for interface files do not match in both projects, Type Coercion failure happens at runtime.
TypeError: Error #1034: Type Coercion failed: cannot convert Rat@153eaf1 to interfaces.IActor.Limitation #3:
While the interface files must be found in the same package structure (#2 above), the StartupCommand.as file cannot. I suspect this is because separate cores share the same filename space or something. If StartupCommand.as exists in analogous packages across the different projects, I get a null object reference error at runtime.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
While limitations #2 and #3 are inconvenient, limitation #1 is crippling (for me). Is there a way around any of these?
I genuinely appreciate anyone's help on the matter.