0

I have a problem with an application that uses RobotLegs in a Flex module. I finally managed to load my module successfully, but when I try to add this line of code in the module view's Mediator:

view.addElementAt(applicationContainer,0);

I get this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.core::UIComponent/getStyle()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:11128]
at mx.core::UIComponent/getConstraintValue()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:9083]
at mx.core::UIComponent/get horizontalCenter()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:9252]
at spark.layouts::BasicLayout/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\layouts\BasicLayout.as:253]
at spark.components.supportClasses::GroupBase/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\GroupBase.as:1148]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430]
at spark.components::Group/validateSize()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\Group.as:1012]
at mx.managers::LayoutManager/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:665]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:816]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]

Why is this happening? The component that I am trying to add is a Group component, any ideas?

for more information i dont use modular robotlegs because the module is loadad in an application that already implements pure robotlegs, so i want to reduce efort to implements modular robotlegs, is a big project, my module loads successfuly but the problems happends when i fire a event that changes the state view of the module for show another component, i use ApplicationDomain.currentDomain in the ModuleLoader.

1 Answers1

0

I searched around a bit and came across this post on Adobe Forums. Someone seems to have the same problem, and it doesn't look like it's related to RobotLegs at all.

Not knowing any of your actual application code, I can't be entirely sure about this, but I believe it's a good guess that your application simply does not pass initialization values to the module correctly.

Following the advice in the second to last reply of the above mentioned post:

Instead of using the name of the module, [module name], in the main application, use an interface that [the module] implements.

you should get to this article about implementing a common interface between module and application. Try to adopt this to your particular module and see if your problem still exists.

weltraumpirat
  • 22,544
  • 5
  • 40
  • 54
  • i am already using a interface, like the tutorial of your link. – Diego Fernando Murillo Valenci Feb 08 '12 at 22:26
  • Perhaps you should share that with us. Along with the code that invokes it. – weltraumpirat Feb 08 '12 at 22:34
  • Did you happen to find a solution to this? I'm making a modular Flex application with Robotlegs and I'm getting the same error. My module does implement an interface through which my main application communicates with it. – Ohas Jun 08 '12 at 02:49
  • weltraumpirat is right; this error has nothing to do with Robotlegs. This error occurs if you refer to your module class in your main application. In my case, the error occurred because I was mapping a module class to a mediator like this: `mediatorMap.mapView(MyModule, MyModuleMediator);`. I changed this to `mediatorMap.mapView(moduleLoader.child, MyModuleMediator); mediatorMap.createMediator(moduleLoader.child);` to solve the problem. – Ohas Jun 08 '12 at 05:41