Skip to content

Instantly share code, notes, and snippets.

@FrancisVarga
Created July 13, 2010 09:18
Show Gist options
  • Save FrancisVarga/473665 to your computer and use it in GitHub Desktop.
Save FrancisVarga/473665 to your computer and use it in GitHub Desktop.
private function onAddTestItemComplete(event : TestCenterEvent):void{
logger.log("onAddTestItemComplet");
var item : TestCenterItem = new TestCenterItem(); // create my view
item.dataProvider = event.testItemDataProvider as RequestItem; // add dataprovider
mediatorMap.createMediator(item); // create a mediator
view.centerContainer.addElement(item); // add it to stage
}
@vizio360
Copy link

I take that somewhere you've done this:

mediatorMap.mapView(TestCenterItem, YourMediatorClass);

@FrancisVarga
Copy link
Author

Ofcuz in my ApplicationContext i have map my mediator to my view!

@vizio360
Copy link

ok, yeah sorry on twitter is difficult to explain something in detail.

what I ended up doing is the following:

var myViewInstance:MyViewClass = new MyView();

mediatorMap.mapView(MyViewClass , MyViewMediator);

mediatorMap.createMediator(myViewInstance);

injector.mapValue(MyViewClass, myViewInstance);

as mentioned on twitter I set myViewInstance as a Singleton via the mapValue method so to have one instance throughout the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment