• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Turning visible true after turning it false

Community Beginner ,
Jun 26, 2017 Jun 26, 2017

Copy link to clipboard

Copied

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.

Views

240

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines