As3 Error 1046 Timer
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up 1046 AS3 Compile Time Error up vote -2 down vote favorite I'm having major issues with this one error //Obligitory Stop stop(); //Imports import flash.events.Event; import flash.events.KeyboardEvent; import fl.motion.easing.Back; import flash.events.MouseEvent; import flash.accessibility.Accessibility; import flash.utils.Timer; import flash.events.TimerEvent; import flash.display.MovieClip; //Variables var bulletSpeed:uint = 20; var scoreData:int; var bullets:Array = new Array(); var killCounter:int; var baddieCounter:int; var currentLevel:int = 1; var baddieDamage:int; var energyCost:int; var target:MovieClip; var baddies:Array = new Array(); var timer:Timer = new Timer(1); var baddieSpeed:int; var score:int; var levelKR:int; var level1KR:int = 10; var level2KR:int = 25; var level3KR:int = 50; var upPressed:Boolean = false; var downPressed:Boolean = false; var Baddie:MovieClip var mySound:Sound = new ShootSFX(); //Level Atributes set if (currentLevel == 1) { baddieSpeed = 2; baddieDamage = 20; timer.delay = 4000; levelKR = level1KR; bulletSpeed = 10; energyCost = 50; var energyTimer:Timer = new Timer(50); var healthTimer:Timer = new Timer(1000); } //Event Listeners stage.addEventListener(MouseEvent.MOUSE_DOWN, fireGun); stage.addEventListener(Event.ENTER_FRAME, moveObjects); timer.addEventListener(TimerEvent.TIMER, addBaddie); rbDash.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey); stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed); stage.addEventListener(KeyboardEvent.KEY_UP, fl_UnsetKeyPressed); //Timers Start timer.start(); energyTimer.start(); healthTimer.start(); //Initialize score Score.text = String("Level "+currentLevel+" - begin!"); //load score data score = scoreData; //Che
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question http://stackoverflow.com/questions/16952758/1046-as3-compile-time-error x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up AS3: ERROR 1046: Type was not found or was not a compile-time constant: Stage and TextField up http://stackoverflow.com/questions/7960561/as3-error-1046-type-was-not-found-or-was-not-a-compile-time-constant-stage-an vote 0 down vote favorite So, I'm making a game and when I test my class into a file I get four errors of the same type '1046: Type was not found or was not a compile-time constant: Stage and TextField'. I've imported everything, please take a look: Game.as package { import flash.display.Stage.*; import flash.filter.GlowFilter.*; import flash.text.TextField.*; import flash.net.URLLoader.*; import flash.net.URLRequest.*; import flash.net.URLRequestMethod.*; import flash.net.URLLoaderDataFormat.*; import flash.net.URLVariables.*; public class Game { public static const STATUS_MENU:int = 1; public static const STATUS_SURVIVAL:int = 2; public static const STATUS_MULTIPLAYER:int = 3; public static const GAME_RUN:int = 1; public static const GAME_PAUSE:int = 2; public static var palco:Stage; public static var profileName:Array; //Name, status, pass public function Game():void { trace("Class Game is online."); } public function transStage(sender:Stage):Stage { palco = sender; palco.align = StageAlign.BOTTOM_LEFT; palco.scaleMode = StageScaleMode.EXACT_FIT; palco.displayState = StageDisplayState.FULL_SCREEN; return(palco); } public function makeGlow(txt:TextField):v
ElementsAdobe Dreamweaver Adobe MuseAdobe Animate CCAdobe Premiere ProAdobe After EffectsAdobe IllustratorAdobe InDesignView all communitiesExplore Menu beginsMeet the expertsLearn our productsConnect with your peersError: You don't have JavaScript enabled. This https://forums.adobe.com/thread/1231115 tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. Please enter a http://www.newgrounds.com/bbs/topic/1287789 title. You can not post a blank message. Please type your message and try again. More discussions in ActionScript 3 All CommunitiesAdobe Animate CC - as3 error HomeActionScript 3 4 Replies Latest reply on Jun 12, 2013 9:54 AM by Mr. Baker the Shoe Maker Help! "1046: Type was not found or was not a compile-time constant:TimerEvent." Mr. Baker the Shoe Maker Jun 12, 2013 9:14 AM I am getting the followiing error in my main document as3 error 1046 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 **********************
Forum Submit Yours! Team Up! Art Latest Greatest Popular Art Forum Submit Yours! Team Up! Portal Community Forums Chat Calendar Artist News Rankings Downloads Wiki Feeds About Feeds Wall Artist Login / Sign Up Upload Your Creations! Forums Everything Games Movies Audio Art Forums Search Latest News: Creep Jam & Summer Jam Winners! | #Inktober Error 1046: AS3 1,369 Views 3 Replies New Topic Respond to this Topic « Return to Game Development Forum Forum Index ElectroKitty ElectroKitty Member since: Oct. 2, 2011 Offline. Send Private Message Browse All Posts (13) Block Forum Stats Member Level 03 Melancholy Error 1046: AS3 2012-01-02 16:24:10 Reply It's my first time using AS3, and I'm having a bit of trouble migrating from AS2. I've found some guides that have got me by so far, but I've got a weird error I can't seem to fix. It says "1046: Type was not found or was not a compile-time constant: TimerEvent." and this is the piece of code it is referring too: var loadTimer:Timer=new Timer(5000); loadTimer.addEventListener(TimerEvent.TIMER, timerListener); function timerListener(e:TimerEvent):void { Strange thing is, it works in a new flash document, but not the one I'm working on (with external AS files and that), but there's no reused variables/mismatches or anything like that, so I don't see what the problem is. Another one is trying to get a loaded image to centre, In AS2 I could just use something like: _root.image._x=((stagewidth-image._width)/2) but AS3 doesn't like it (with the new property names of course). I think it's because I had to create a bunch of different variables and objects to load the image. Tracing image.width just returns 0, I think because it's just a placeholder for the actual image. I tried creating another variable to get the image width from the server where the image is hosted, but it didn't work out too well. Any help would be great. ProfessorFlash ProfessorFlash Member since: Oct. 6, 2007 Offline. Send Private Message Browse All Posts (1,704) Block Forum Stats Member Level 32 Programmer Response to Error 1046: AS3 2012-01-02 18:24:53 Reply Have you imported the timeevent? import flash.events.TimerEvent; You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language