Skip to main content
rjoshicool
Inspiring
June 11, 2012
Answered

Change the firstView in ViewNavigatorApplication through AS3

  • June 11, 2012
  • 2 replies
  • 1328 views

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 has been closed for replies.
Correct answer Phil Flash

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
June 12, 2012

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

rjoshicool
Inspiring
June 14, 2012

Thanks, that thing worked!