Hello ActionScript Springers!
I'm not from a Java background, and don't know much about Java Spring, but I understand the concept of Dependency Injection and IOC containers. I've been struggling to figure out how to set up a mechanism similar to how the Injectors and ObjectBuilder tags work in Mate.
What's nice about those tags is that you can set up a system that hooks into Event.ADDED_TO_STAGE (or FlexEvent.CREATION_COMPLETE) to do DI for view components as they are added to stage. Here is how I automatically wire up Mediators in Mate (shh.. don't tell Mate fanatics - they prefer Presenters to Mediators):
Whenever a PopWindow is added to stage, a new PopWindowMediator is created that has a reference to the PopWindow injected into it (and references to a global AppController and IEventDispatcher).Code:<EventMap xmlns="blah" xmlns:mx="blah"> <ObjectBuilder id="controller" generator="{AppContoller}" registerTarget="true" /> <Injectors target="{AppContoller}"> <PropertyInjector targetKey="dispatcher" source="{scope.dispatcher}" /> </Injectors> <Injectors target="{PopWindow}"> <ObjectBuilder generator="{PopWindowMediator}" registerTarget="true" cache="none"> <Properties view="{event.injectorTarget}" dispatcher="{scope.dispatcher}" /> </ObjectBuilder> </Injectors> <Injectors target="{PopWindowMediator}"> <PropertyInjector targetKey="dispatcher" source="{scope.dispatcher}" /> <PropertyInjector targetKey="controller" source="{AppContoller}" /> </Injectors> </EventMap>
Is such a thing possible with Spring ActionScript? If so, how might I go about it?
Many thanks!


Reply With Quote
