Nothing but a Blank Screen/ TimerClass problem? EventListener?
When I test the code below nothing happens. I just get a blank screen.
What is supposed to happen?
When the program opens a splash screen should be added for 3 seconds and then fade out. Then some main screen movie clips should be added to the stage.
package
{
//**************** IMPORT STATMENTS *********************
import flash.display.MovieClip;
import com.greensock.TweenLite;
import flash.utils.Timer;
public class Main extends MovieClip
{
//***************** Variables ***************************
private var MainScene:Main = new Main();
private var PopUp_MoreApps:MoreApps_mc = new MoreApps_mc();
private var PopUp_About:About_mc = new About_mc();
//*****SPLASH SCREEN ***
private var mc_timerSplash:Timer;
private var splashScreen:mcSplashScreen;
//*****************CONSTRUCTOR CODE ********************************************************************* **************
public function Main()
{
mc_timerSplash = new Timer(3000,1);
mc_timerSplash.addEventListener(TimerEvent.TIMER, StartTimer);
//When timer is finished stop the timer;
mc_timerSplash.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleted);
splashScreen = new mcSplashScreen();
//Adds the splash screen
addChild(splashScreen);
splashScreen.x = stage.stageWidth / 2;
splashScreen.y = stage.stageHeight / 2;
mc_timerSplash.start();
}
//*********** FUNCTIONS *********************************
private function timerCompleted(e:TimerEvent):void
{
mc_timerSplash.stop();
mc_timerSplash = null;
}
private function StartTimer(e:TimerEvent):void
{
TweenLite.to(splashScreen, 1, {alpha:0, onComplete: SplashScreen});
}
private function SplashScreen():void
{
removeChild(splashScreen);
addMainScene();
}
//adds the main screen movieclips
private function addMainScene():void
{
addChild(MainScene);
MainScene.x = 489;
MainScene.y = 350;
//TweenLite.from(MainScene.wbbIntro_mc, .5, {alpha: 0});
TweenLite.from(MainScene, 1, {alpha:0});
TweenLite.to(MainScene.girls_mc, 1, {y:395, delay:.3});
TweenLite.to(MainScene.boys_mc, .5, {y:396, delay: .6});
TweenLite.to(MainScene.Joe_mc, .5, {y:339, delay: 1});
TweenLite.to(MainScene.Paul_mc, .5, {y:322, delay:1.2});
}
private function removeMainScene():void
{
removeChild(MainScene);
TweenLite.to(MainScene.girls_mc, .1, {y:690});
TweenLite.to(MainScene.boys_mc, .1, {y:693});
TweenLite.to(MainScene.Joe_mc, .1, {y:636});
TweenLite.to(MainScene.Paul_mc, .1, {y:619});
}
}
}