0 Replies Latest reply on Jun 26, 2017 7:09 PM by jdaston

    Turning visible true after turning it false

    jdaston Level 1

      I have a mobile as3 app that has two screens that are class files load with addChild, I am trying to switch between them with a menu approach that changes the visible property of both, but I can't make the one that has the visible=false property become visible.  The menu code is as follows:

       

      package
      {
      import flash.display.Sprite;
      import flash.display.StageAlign;
      import flash.display.StageScaleMode;
      import flash.events.Event;
      import flash.events.MouseEvent;
      import events.NavigationEvent;


      import screens.LessonScrn;
      import screens.MenuScrn;

      public class Main extends Sprite
      {
        public var menuscreen:MenuScrn;
        public var lsnscrn:LessonScrn;
        public function Main()
        {
         super();
        
         // support autoOrients
         stage.align = StageAlign.TOP_LEFT;
         stage.scaleMode = StageScaleMode.NO_SCALE;
         menuscreen = new MenuScrn();
         addChild(menuscreen);
        
        
         lsnscrn = new LessonScrn;
         addChild(lsnscrn);
         lsnscrn.disposeTemporarily();
        
        }
       
        public function onChangeScreen(event:NavigationEvent):void
        {
         switch (event.params.id)
         {
          case "lsn":
           trace ("Attempt to begin lesson screen");
           lsnscrn.disposeTemporarily();
           menuscreen.initialize();
           break;
         
          case "menu":
           menuscreen.disposeTemporarily()
           lsnscrn.initialize();
           addChild(lsnscrn);
           break;
         }
        } 
       
      }
      }

       

      the initialize and disposetemporarily are as follows:

      public function disposeTemporarily():void

        {

         this.visible = false;

        }

       

        public function initialize():void

        {

         this.visible = true;

        }

       

      There is no errors, it just will not re initialize the screens.  I tried using the addChild and removeChild methods but got the same result.  Any ideas would be helpful.