I'm trying to mediate the main application class ( the 'Document class' of a Flash *.fla project)

I have this on the Application Context startup():

... mediatorMap.mapView(MyApplication,MyApplicationMediator); mediatorMap.createMediator(contextView);

The MyApplicationMediator:

public class MyApplicationMediator extends Mediator {
[Inject]
public var view:MyApplication;
override public function onRegister():void {
trace("I am registered!");
}

So onRegister() gets called, but view is null. Also when I try to add the eventListeners I get a null reference error.

有帮助吗?

解决方案

This is generally a result of compiling robotlegs from source and not having keep-as3-metadata +=Inject as a compiler option.

I think that your createMediator call is superfluous. The contextView is a "special" case in that it is already added to the stage so by default when the mediator is set via mapView it gets created automatically.

This Common Problems section of the wiki is a pretty decent resource.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top