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

Nothing but a Blank Screen/ TimerClass problem? EventListener?

Engaged ,
Jun 12, 2013 Jun 12, 2013

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});

        }

    }

}

TOPICS
ActionScript
830
Translate
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

correct answers 1 Correct answer

Community Expert , Jun 12, 2013 Jun 12, 2013

then your problem is with Main.

what's your document class?  what's the class of your MainScene variable?   (and, those can't be the same.)

Translate
Community Expert ,
Jun 12, 2013 Jun 12, 2013

what's mcSplashScreen look like and where's its reg point?

Translate
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
Engaged ,
Jun 12, 2013 Jun 12, 2013

It is a retangular movie clip and the reg point is in the center.

Translate
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
Community Expert ,
Jun 12, 2013 Jun 12, 2013

then your problem is with Main.

what's your document class?  what's the class of your MainScene variable?   (and, those can't be the same.)

Translate
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
Engaged ,
Jun 12, 2013 Jun 12, 2013

It worked!

I changed MainScene to mcMainScene.

Translate
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
Community Expert ,
Jun 12, 2013 Jun 12, 2013
LATEST

great.

Translate
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