I'm having a problem with this menu tutorial I followed from ASGamer. I have done and used most, if not all of the tutorials from that site.
Anyway my problem is their base menu class;
package com.game.scripts.menu
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
import com.caurina.transitions.Tweener;
public class BaseMenu extends MovieClip
{
public var stageRef:Stage;
public var loadNext:BaseMenu;
public function BaseMenu()
{
alpha = 0;
}
public function Unload(loadMe:BaseMenu = null):void
{
if(loadMe != null)
{
loadNext = loadMe;
}
Tweener.addTween(this, {alpha:0, time:0.7, onComplete:Remove});
}
public function Remove():void
{
//dispatchEvent(new Event("menuRemoved"));
if(stageRef.contains(this))
{
stageRef.removeChild(this);
}
if(loadNext != null)
{
loadNext.Load();
}
}
public function Load():void
{
stageRef.addChild(this);
Tweener.addTween(this, {alpha:1, time:0.7});
}
}
}
Whenever I use the Remove() function, which is also used by the Unload() function, my stage.addEventListeners breaks. Particularly my stage.addEventListener(KeyboardEvent.KEY_UP, KeyUpHandler) in another class does not execute at all.
Is there another way I can remove the menus without breaking the stage? Or if you know of a better menu tutorial, a link would be greatly appreciated :D
EDIT I just commented everything in the Remove() function and key handler is still not working.
EDIT 2 The first edit only applied to my MainMenu, my other menus seem fine. I commented this part;
if(stageRef.contains(this))
{
stageRef.removeChild(this);
}
and my KeyUpHandler works fine. So I'm assuming that flash will not remove the movieclips for me, or will I be fine and it will be removed?