I have the following default mxml configuration.
<s:ViewNavigatorApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
firstView="Home"
creationComplete="init()"
>
Is it possible to have a conditional value for firstView?
I was looking for a way to implement my application in 3 different views for mobile compatibility.
So I would like to create different packages for each views. Is there any workaround for this?
You can define the views manually by using the ViewNavigator - remove the firstView from your MXML and do something like that in your init() method:
private function init():void
{
if(something)
{
navigator.pushView(Home);
}
else
{
navigator.pushView(OtherView);
}
}
// pass myData as data to the new view (will be accessible as .data property in the Home view):
navigator.pushView(Home, myData);
// remove the last view from the viewstack:
navigator.popView();
This article might help