views:

56

answers:

2

I'm working on an existing modular project that was built in PureMVC. Instead of converting everything over to RobotLegs, I want to create a new module using RobotLegs and plug it into the pureMVC shell. Currently, when the module loads, I get the following flash error:

ReferenceError: Error #1065: Variable IMediatorMap is not defined.

Inititally, I thought it was because my module needed a pureMVC Mediator to call the pureMVC StartupCommand to get things "hooked up" and THEN create the RobotLegs' Context. However, that didn't work and I'm still getting the error. Do you have any idea what's going on and if so, how I can get pass it?

Thanks.

+1  A: 

I don't believe your problem has anything to do with PureMVC or RobotLegs. It sounds like your RobotLegs module does not contain the RobotLegs library and neither does your main application. Your module is not linking in the RobotLegs .swc. If you are adding the RobotLegs .swc to the main application but never using it, then the classes will not be compiled into the application. The mxmlc and Flash/Flex Builder compilers do not include classes into a SWF that are not used.

To solve this, you can force the entire library to be included by using the -include-libraries option in the main application. You could also change the link options on the module to "Merged into code" to include the RobotLegs .swc there.

Jonathan Branam
Hum... okay. I can try this too. Thanks, Jonathan.
LazerWonder
It sounds like you've found the right answer above. It sounds like RobotLegs was searching the wrong ApplicationDomain for the definitions it required. Good luck with the rest of the app!
Jonathan Branam
+1  A: 

Okay -- so I was reading all over the place and trying to figure out what was the matter. In RobotLegs' support discussion, there was a similar topic posted. It turned out that there was a bug in RL's framework, something to do with the ApplicationDomain. Read here:

http://knowledge.robotlegs.org/discussions/problems/160-child-applicationdomains-break-the-injector

Well, the solution on that post was to use RL v.1.3.0, which I was. But following that line of thought, I removed the library reference of SwiftSuspender-1.5.1.swc in the RL's lib/ folder, and downloaded SwiftSuspender from GitHub instead. It's also v.1.5.1, but for whatever reason, the one from GitHub works. I replaced the one that came with RL's framework with the one I got from GitHub and now it runs without errors.... for now.

Thanks. :)

LazerWonder
Very interesting! Following that thread it does seem that RobotLegs had specific code that referenced the ApplicationDomain incorrectly. I expect this is the right answer.
Jonathan Branam
It was more that Robotlegs didn't really care about ApplicationDomain at all (didn't have a way to supply the ApplicationDomain, etc). We added some support to SwiftSuspenders to accomodate the Modular utility, but it left a lot of holes in a broader modular solution. Luckily that is getting fleshed out a bit now that more people are doing modular apps.
Joel Hooks