Quantcast
Channel: Adobe Community : Discussion List - Using Flash Builder
Viewing all articles
Browse latest Browse all 1802

Turning visible true after turning it false

$
0
0

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.


Viewing all articles
Browse latest Browse all 1802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>