Hey there,
I finally was able to have access to the viewNavigator through an injected singleton within a command.
public class ViewReference
{
[ViewNavigator]
public var viewNavigator:ViewNavigator;
}
public class PushViewCommand implements IEventAwareCommand
{
[Inject(source="viewReference.viewNavigator")]
public var viewNavigator:ViewNavigator;
}
A few refactoring later, I would like to configure Swiz through an actionscript class instead of MXML, like the wolling:
firstView="views.WelcomeView">
<fx:Declarations>
<config:SomeSwizConfig context="{this}"/>
</fx:Declarations>
</s:ViewNavigatorApplication>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public class SomeSwizConfig
{
public function set context(value:IEventDispatcher):void
{
var swizConfig:SwizConfig = new SwizConfig();
swizConfig.setUpEventType = FlexEvent.PREINITIALIZE;
swizConfig.viewPackages = ["views.*"];
swizConfig.eventPackages = ["event.*"];
var beans:Array = [];
beans.push(new ViewReference());
var beanProvider:BeanProvider = new BeanProvider(beans);
var swiz:Swiz = new Swiz(value, swizConfig, null, [beanProvider]);
swiz.init();
}
}
Unfortunately, the viewNavigator in the ViewReference class seems always null whatsoever.
Any suggestion on how to get access again to the ViewNavigator through commands?
Thanks
Thomas