Skip to main content
Mr. Baker the Shoe Maker
Inspiring
June 12, 2013
Answered

Help! "1046: Type was not found or was not a compile-time constant:TimerEvent."

  • June 12, 2013
  • 1 reply
  • 2852 views

I am getting the followiing error in my main document class:

"1046: Type was not found or was not a compile-time constant:TimerEvent."

It's showing in line 47 and 54 (in red below). Any help would be appreciated. BTW, this is my first time creating a main document class since graduating to class files!:

package

{

    //**************** IMPORT STATMENTS *********************

    import flash.display.MovieClip;

    import com.greensock.TweenLite;

    import flash.utils.Timer;

    public class Main extends MovieClip

    {

        //***************** Variables ***************************

        /*private var appStoreURL:URLRequest = new URLRequest("http://itunes.apple.com/us/artist/quackenworth/id518210161");

        private var facebookURL:URLRequest = new URLRequest("http://www.facebook.com/quackenworth");

        private var twitterURL:URLRequest = new URLRequest("http://www.twitter.com/quackenworth");*/

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

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

        }

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

        }

    }

}

This topic has been closed for replies.
Correct answer Ned Murphy

Add a line to import the TimerEvent class:

import flash.events.TimerEvent;

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
June 12, 2013

Add a line to import the TimerEvent class:

import flash.events.TimerEvent;

Mr. Baker the Shoe Maker
Inspiring
June 12, 2013

That was it. Thanks!

Ned Murphy
Legend
June 12, 2013

You're welcome