Skip to main content
rjoshicool
Inspiring
Jun 11, 2012 6:53 AM UTC
Answered

Change the firstView in ViewNavigatorApplication through AS3

I have a view navigator application which has a first view defined in the mxml code. How can I control this programatically so that I can apply a check and change the firstview accordingly? Is there a method of the ViewNavigatorApplication which needs to be overridden?

This topic is closed to new replies. Start a new post to keep the conversation going.
Phil FlashCorrect answer
Inspiring
Jun 12, 2012 4:29 PM UTC

Hi,

In the ViewNavigatorApplication, override the method partAdded like this:

override protected function partAdded(partName:String, instance:Object):void

{

    super.partAdded(partName, instance);

    var stage:Stage = systemManager.stage;

    if (stage.stageWidth <= 480 && stage.stageHeight <= 480)

    {

        navigator.firstView = mySmallHomeView;

    }

    else

    {

        navigator.firstView = myNormalHomeView;

    }

}

Philippe

2 replies

Phil FlashCorrect answer
Inspiring
Jun 12, 2012 4:29 PM UTC

Hi,

In the ViewNavigatorApplication, override the method partAdded like this:

override protected function partAdded(partName:String, instance:Object):void

{

    super.partAdded(partName, instance);

    var stage:Stage = systemManager.stage;

    if (stage.stageWidth <= 480 && stage.stageHeight <= 480)

    {

        navigator.firstView = mySmallHomeView;

    }

    else

    {

        navigator.firstView = myNormalHomeView;

    }

}

Philippe

Translate
rjoshicool
Inspiring
Jun 14, 2012 12:15 PM UTC

Thanks, that thing worked!

Translate