In what order are these actions being done?
In this code I haven't used a loader but JUST to let the user realize that something is going on, when user clicks on "next" and a huge class in going to function, I firstly show a "loadingScreen" that simply says LOADING and then call that huge function "mazeDisp.creatMaze()"....
My problem is that why the loadingScreen is not shown before that function is being called!!!
function nextClicked(e:MouseEvent):void {
menu.visible = false;
pauseBtn.visible = false;
loadingScreen.visible = true; //HERE I NEED IT TO BE SHOWN BUT WON'T
addChildAt(ipad0,0);
ipad0.addChildAt(mazeDisp,0);
ipad0.addChildAt(ipad1,0);
ipad1.addChildAt(ipad2,0);
mazeDisp.clearb2World();
mazeDisp.createMaze(75,100,8); //THIS IS THAT HUGE FUNCTION (of another class) WHICH INCLUDES A LOT OF Box2D Classes.
}
function readyHandler(e:Event):void {
menu.visible = false;
loadingScreen.visible = false; //HERE I HIDE IT AGAIN
pauseBtn.visible = true;
isPlaying = true;
addEventListener(Event.ENTER_FRAME, frameHandler);
}