1046: Type not a compile-time constant: TimerEvent.

I have a simple space ship in an fla
have this .as file
but still getting the error
related to the line "public function
moveClip(event:TimerEvent):void {"

instead of using
import flash.events.TimerEvent.*;
use
import flash.events.TimerEvent;
and you probably need
import flash.utils.Timer;

Similar Messages

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

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

    Now that the error is solved, when I test 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.

  • 1046:  not a compile-time constant: TimerEvent.

    I know this is simple but I just cannot see what I am doing
    wrong
    it is in reference to "public function
    moveClip(event:TimerEvent):void {"
    any help is appreciated .
    my code is attached
    thank you

    I am old .. and I guess I just see what I want to see ...ty
    for your help
    I moved it to AS3 ...
    I added the timer change found a few more errors and
    then I got same error ...

  • Trouble adding a web url link to an existing file: 1046: Type was not found or was not a compile-time constant:

    Hi There,
    We're trying to add a simple link to an existing Flash file. There looks to be at least 7 separate .as files and a separate swf that loads the main swf which all seems overly complex for what is essentially a page with six buttons on it.
    However, we need to add a URL to some of the text. So we converted the text to a button, added an instance name of <ssbpurchasetickets_btn> then added the following Actionscript into the actions layer on the frame the text/button appears:
    ssbpurchasetickets_btn.addEventListener(MouseEvent.CLICK, ssbButtonPurchase);
    function ssbButtonPurchase(event:MouseEvent):void
    navigateToURL(new URLRequest("http://www.url.com/tickets.html"));
    When we publish the file we get the following error which seems to cascade into a whole bunch more errors:
    Description: 1046: Type was not found or was not a compile-time constant: MouseEvent.
    Source: function ssbButtonPurchase(event:MouseEvent):void
    We added "ssb" onto the button and functions to ensure there were no conflicts but the same thing occurred. If we copy the button into a new file everything works so it must be conflicting with something in the main files.
    Any help would be MUCH appreciated!!!!
    Cheers

    Thanks for the reply Ned,
    The file is set to use AS3 and I'm pretty sure the original should be set to AS3 as the .as files look like AS3 syntax to me - here's a sample:
    protected function handleWwrdButtonClick(e:ButtonEvent):void {
    Browser.open(globalVar.xml.wwrd.item[0].@url, globalVar.xml.wwrd.item[0].@target);
    OmnitureTracker.trackFeaturedContentClick('http://www.url.com/movies/international', 'wwrd_button');
    timer.stop();
    timer.removeEventListener(TimerEvent.TIMER, onTimer);
    I'm wondering if all the Actionscript has be placed into one of the .as files as there isn't any Actionscript in the Flash project - a part from the odd stop()
    Really stuck on this one (I'm not an expert at all) so any help in deciphering the project would be much appreciated.
    Cheers

  • 1046: Type was not found or was not a compile-time constant: Event.

    I am more than a little frustrated.  I'm using Flash Professional CS5.5, attempting to publish ActionScript 3.0 for FlashPlayer 10.2
    My code begins with:
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    Then much later I have:
    teamFourCar_mc.addEventListener(Event.ENTER_FRAME, trackPosition);
    function trackPosition (event:Event)
    and I keep getting a compiler error:
    Scene 1, Layer 'actions', Frame 1, Line 434
    1046: Type was not found or was not a compile-time constant: Event.
    I have imported the class "Events".  I have successfully used the same construction in other scripts... in fact, virtually the same construction is included in Code Snippets as Fade In and Fade Out.  Adding ":void" after (event:Event) makes no difference.  I have Googled - to no avail - and spent the better part of a day reading through the on-line help files, but the solution is still eluding me.
    It's probably so simple I'm going to smack myself in the forehead and mutter "Duh!" when I find a solution...
    If you can do anything to hasten that event (no pun intended) I (with the possible exception of my forehead) will be very grateful.
    TIA
    Terry

    Sinious:
    The entire code of the main movie clip is at http://pastebin.com/JYfLUhh1
    A sample of one of the four "problem" movie clips is at http://pastebin.com/gQGDyngx
    There is nothing wrong with the "problem" clip.  The problems are in the main movie clip:
    Scene 1, Layer 'actions', Frame 1, Line 427
    1046: Type was not found or was not a compile-time constant: Event.
    Scene 1, Layer 'actions', Frame 1, Line 612
    1046: Type was not found or was not a compile-time constant: Event.
    Scene 1, Layer 'actions', Frame 1, Line 1819
    1046: Type was not found or was not a compile-time constant: Event.
    There are the only three occurrences of a function with (event:Event).  Two are ENTER_FRAME (427 & 1819) The other is COMPLETE from Loader.info
    Auto format reported a syntax error "near 'if(movingCar.currentFrame == (dieRoll * 24) + movingCarPosition)' " but I can't detect what, if anything, is wrong with it.
    I'm not an experienced developer... in fact, the last programming I did before taking up Flash three months ago was with QuickBasic under DOS 6.2... therefore, please try not to roll your eyes too much when you see how inelegant the code is.
    I have a working version, but it's over 7,000 lines and a memory hog.  I'm trying to make it more elegant and more efficient.  BTW, the three (event:Event) functions are in the working version in more or less the same places, with the same calling code.
    I hope you can figure it out.
    Thank you in advance

  • Error 1046: Type was not found or was not a compile-time constant: Component Event.

    Hi Everyone..
    I am getting an Error 1046: Type was not found or was not a compile-time constant: Component Event.
    The ComponentEvent class has been imported,and also the event handling code is there. I am not sure what else is wrong, hope somebody can advise me. Thanks. The code is below, the point where the error occurs as indicated by the compiler has been highlighted.
    package 
    import flash.display.Sprite;
    import flash.media.Camera;
    import flash.media.Microphone;
    import flash.media.Video;
    import fl.controls.TextArea;
    import fl.controls.Button;
    import fl.controls.TextInput;
    import flash.events.SyncEvent;
    import flash.events.MouseEvent;
    import flash.events.FocusEvent;
    import flash.net.SharedObject;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.events.NetStatusEvent;
    import flash.events.FocusEvent;
    import flash.events.ComponentEvent;
    public class VideoChat extends Sprite
      private var button:Button;
      private var text_so:SharedObject; 
      private var textArea:TextArea;
      private var textInput:TextInput;
      private var chatName:TextInput; 
      private var nc:NetConnection;
      private var nsOut:NetStream;
      private var nsIn:NetStream;
      private var rtmpNow:String;
      private var msg:Boolean; 
      private var cam:Camera;
      private var mic:Microphone;
      private var vid:Video;
      public function VideoChat ()
       //Set up UI
       textArea = new TextArea();
       textArea.setSize(500,280);
       textArea.move(20,54);
       addChild(textArea);
       textInput = new TextInput();
       textInput.setSize(500,24);
       textInput.move(20,340);
       textInput.addEventListener(ComponentEvent.ENTER,checkKey);
       addChild(textInput);
       button = new Button();
       button.width=50;
       button.label="Send";
       button.move(20,370);
       button.addEventListener(MouseEvent.CLICK, sendMsg);
       addChild(button);
       chatName = new TextInput;
       chatName.setSize (100,24);
       chatName.move (80,370);
       chatName.text="<Enter Name>";
       chatName.addEventListener (FocusEvent.FOCUS_IN, cleanName);
       addChild(chatName); 
       //Connect
       rtmpNow="rtmp:/VideoChat ";  
       nc=new NetConnection;
       nc.connect (rtmpNow);
       nc.addEventListener(NetStatusEvent.NET_STATUS,doSO);
       cam = Camera.getCamera();
       mic=Microphone.getMicrophone();
       //Camera Settings
       cam.setKeyFrameInterval(15);
       cam.setMode (240, 180, 15, false);
       cam.setMotionLevel(35,3000);
       cam.setQuality(40000 / 8,0);
       //Microphone Settings
       mic.gain = 85;
       mic.rate=11;
       mic.setSilenceLevel (25,1000);
       mic.setUseEchoSuppression (true);
       //Video Setup
       vid=new Video(cam.width, cam.height);
       addChild (vid);
       vid.x=10, vid.y=20;  
       //Attach local video and camera
       vid.attachCamera(cam);  
      private function doSO(e:NetStatusEvent):void
       good=e.info.code == "NetConnection.Connect.Success";
       if(good)
        //Set up shared object
        text_so=SharedObject.getRemote("test", nc.uri, false);
        text_so.connect (nc);
        text_so.addEventListener(SyncEvent.SYNC, checkSO);
      private function checkSO(e:SyncEvent):void
       for (var chung:uint; change<e.changeList.length; chng++)
        switch(e.chageList[chng].code)
         case "clear":
          break;
         case "success":
          break;
         case "change":
          textArea.appendText (text_so.data.msg + "\n");
          break;
      private function cleanName(e:FocusEvent): void
       chatName.text="";
      private function sendMsg(e:MouseEvent):void
       noName=(chatName.text=="<Enter Name>" || chatName.text=="");
       if (noName)
         textArea.appendText("You must enter your name \n");
       else
        text_so.setProperty("msg", chatName.text +": " + textInput.text);
        textArea.appendText (chatName.text +": "+textInput.text +"\n");
        textInput.text="";
      private function checkKey (e:ComponentEvent):void
       noName=(chatName.text=="<Enter Name>" || chatName.text=="");
       if (noName)
         textArea.appendText("You must enter your name \n");
       else
        text_so.setProperty("msg", chatName.text +": " + textInput.text);
        textArea.appendText (chatName.text +": "+textInput.text +"\n");
        textInput.text="";
      //Create NetStream instances
      private function checkConnect  (e:NetStatusEvent):void
       msg=e.info.code == "NetConnection.Connect.Success";
       if(msg)
        nsOut=new NetStream(nc);
        nsIn=new NetStream(nc);
        //NetStream
        nsOut.attachAudio(mic);
        nsOut.attachCamera(cam);
        nsOut.publish("camstream");
        nsIn.play("camstream");

    Hi Guys...
    I have found out what is wrong. I was importing the wrong package the correct one should have been:
    import fl.events.ComponentEvent;
    instead of
    import flash.events.ComponentEvent;
    I hope this is helpful for anyone caught in a simillar situation as me...Thanks..

  • Type was not found or was not a compile-time constant?

    Hi guys,
    I'm going nuts. I've got this movieclip that I made into a
    button with ActionScript. When clicked, it
    should go to a frame in my main timeline labeled "beansbus",
    but whenever I try to test the movie out, Flash
    gives me this error:
    1046: Type was not found or was not a compile-time constant:
    bus.
    I've looked around on the internet and I've been told that
    this error can
    crop up if the instance name is the same as a library object.
    That WAS the
    problem, but I renamed the library object to Cutebus, so that
    should have fixed it, I hope. There was another fix that involved
    something called TextFields in my movieclip, but I don't have
    those...
    My code looks like this, which was copied and pasted from an
    in-class tutorial that DOES work, with no problems.
    Thanks in advance for any light you can shed on this.

    actually the error:
    quote:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference. at
    beans_fla::MainTimeline/frame1()[beans_fla.MainTimeline::frame1:3]
    may not obviously give the line number at first
    glance, but it does! 'frame 1:3' refers to frame 1, line 3. which
    if your code post was accurate to line numbers, refers to:
    quote:
    bus.stop();
    so i'd suggest looking at your bus clip and
    ensuring that you have correctly defined its instance name. Also,
    make sure you have this correctly defined in each keyframe that the
    clip appears.

  • Initializer element is not a compile-time constant in Xcode

    hi.......Every one
    ModelController.h
    #import <Foundation/Foundation.h>
    @interface ModelController : NSObject
    @property(nonatomic , strong)NSArray *states_Array;
    @end
    ModelController.m
    #import "ModelController.h"
    @implementation ModelController
    @synthesize states_Array;
    states_Array = [[NSArray alloc]initWithObjects:@1,@2,@3, nil];
    @end
    Now i want to access these array in MY TableViewController at cellForAtIndexPath
    Thanks InAdvance

    If you're using Flex 3.4 SDK, put only AdobeSpellingEngine.swc and AdobeSpellingUI.swc in your libs folder. (AdobeSpellingUIEx.swc is for Flex 4)
    For more details, please refer to the release notes
    http://labs.adobe.com/technologies/squiggly/releasenotes.html
    Hope this helps.

  • Constants v/s compile time constants.

    Hi to all.
    I got a problem in understanding compile time constants.
    I was reading about switch statement, and found a fact:
    the case constant in switch statement should be compile time constant.
    and example they have given is:
    final int a=1;
    final int b;
    b=2;
    int x=0;
    switch(x)
    case a: //ok.
    case b: //compiler error.
    so is it true, that compile time constants are only those which are final and are initialized at the time of declaration itself.
    then what b will be called, "runtime constant" (sounds odd).

    I once read on a post here (or article) that the
    compiler will replace any variable name you set in
    the switch case with the actual value. That is why
    it
    works on 'a' but not on 'b'. At compile time the
    compiler only knows the value of 'a'.
    That is not why you can use a but not b for the
    switch. The reason is that the compiler knows the
    value of a but not of b.
    What's the difference?

  • Class loading and Compile time constants

    Hi,
    I am not sure if this is the right place for basic questions. I would appreciate any help.
    From my understanding, the compile time constants are folded into the byte code during compilation. ( E.g. static final int MAX = 10; ). When I access a compile time constant from a different class, I can see that the class that holds the constant is not loaded at all. ( using -verbose:class option )
    Now, my question is, how does JVM access the class that holds the constant without loading it ?! Without the class being loaded, how can the JVM get a binary representation of the same ? What am I missing here ?
    thanks,
    Soumya.

    class A {
      public static final int X = 10;
    class B {
      void foo(int n) {
        switch n {
          case A.X:
            yadda();
    }The value of X (10) from class A is "folded" into the bytecode of class B.

  • Compile time constants

    Hey i have a doubt regd compile time constants
    byte a =10,b=20;
    byte c= a+b; // compile time error coz a+b may exceed byte limit
    int a=10,b=20;
    int d=a+b; // not showing any error . a+b may exceed int limit
    can anyone clear me int his

    public class Test {
        public static void main(String[] args) {
            byte a = 10, b = 20;
            byte c = a+b;  //syntax error: "possible loss of precision"
            final byte d = 10, e = 20;
            byte f = d+e;  //OK
    }It's not about overflow, but implicit casting: in the expression a+b, bytes a and b
    are widened to int and the addition is 32-bit addition -- the result is an int.
    When you attempt to assign an int to a byte, the top three bytes are discarded,
    hence the syntax error "possible loss of precision". You get the same
    error message when assigning a double to a float.
    Why don't I get the syntax error with my d-e-f example? Variables d and e
    are declared final, so the compiler folds in their values. Thus it know 10+20
    is 30 and that the int value 30 fits into one byte.

  • Compile time constant

    what is compile time constant
    1. final int a=9;
    2 final int b
    b=9;
    is 2 statement not a compile time constant

    Screen13Name wrote:
    but we cannot change its value then how it is not a constantThe term "compile-time constant" has a very specific meaning and very specific implications in the Java language.
    Just because something isn't a compile-time constant doesn't mean that it can be changed.

  • Output type not triggered on time

    Dear All,
    I have an issue on output determination.
    We have a list of outputs on Delivery which will be determined after the loading start checked in Shipment based on activity profile assigned to the Shipment type.
    Out of all the outputs, only one output is not printed on time (But it is determined on time).
    We checked the condition record and everything, all found ok. But still we are facing this issue.
    Could anyone suggest me on this.
    Regards,
    Mullairaja

    Hi Mullairaj,
      If i understand it right, you are able to trigger output for both the cases but only one is picked by batch job and so you are only seeing one "Green" output but the other stays "Yellow". if this is right then did you check if the batch job is calling program RSNAST00 with right variants ?. Does this JOB has variant to pick both the Outputs.
    Let me know.
    Thanks!

  • "1046: Type was not found" for a custom class calling a custom class

    This should be easy... but I've spent two days on nothing but this error.... I am absolutely at my wit's end.
    Basically, I've got a "character" container linked to a MovieClip in the library that is supposed to act as a container for various body parts; head, shirt, pants, etc. For simplicity, I've just got Character class and Head class, both in a "char" package, both classes are named the same as their respective files (Character.as and Head.as, both in an actual file called "char"). Character class is supposed to create an instance of Head, but I always get this 1046 error. The problem is that I've got other body parts with nearly identical classes that ARENT throwing a 1046 error and are working just fine. I went and made a new project to see if I was still having the problem with just character calling 1 simple body part. I do.
    In the symbol properties, it's Exported for Actionscript & Export in Frame 1... the class is "char.Head" and "char.Character" respectively. I have tried everything I can find or think of, I've done dozens of Google searches and sifted through dozens of forums. I can't find anything and I've been working on this problem for 24 straight working hours now. I'm completely exasperated......
    package char {
    import flash.display.MovieClip;
    import flash.display.Stage;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    import fl.motion.Color;
    import char.Head;
    public class Character extends MovieClip {
    // 1046: Type was not found or was not a compile-time constant: Head
    private var _head:Head;
    // reference to get the stage later
    private var stageRef:Stage;
    public function Character(stageRef:Stage=null) {
    trace("NEW CHARACTER");
    //1180 Call to a possibly undefined method Head;
    _head=new Head();
    And here's the contents of Head.as
    package char {
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.display.Stage;
    import flash.geom.ColorTransform;
    public class Head extends MovieClip {
    private var skin_type:uint;
    public function Head() {
    trace ("NEW HEAD");
    Now if I declare the head variable and create a new instance of it in my document class, no problem whatsoever. If I do it in my Character class, it just doesn't stop giving me this error!!! Somebody please help me.
    1046: Type was not found or was not a compile-time constant: Head
    1180 Call to a possibly undefined method Head;

    There is a blank movieclip named Character in the library, yup.
    Also in my main handler for my document class calls "mainCharacter = new Character(); "
    Here's a chunk of the code from the document class. For the record, it calls "head" as just a test and that works fine. Just doesn't work in "Character"
    import char.Character;
    import char.Head;
    public class MainHandler extends MovieClip {
    private static var _instance:MainHandler;
    public static function get instance():MainHandler { return _instance; }
    public var mainCharacter:Character;
    public var head_:Head;
    public function MainHandler() {
    _instance = this;
    mainCharacter = new Character();
    head_=new Head();

  • Type not found: Point in Flash CS5.5 on Mac when player is AIR for iOS

    I've installed the AIR 3.0 SDK as detailed by Porawee in this thread, including his corrections to the xml for iPhone further down in the thread. Everything worked at first, but since then I've rebooted my computer, and since the reboot I can no longer compile an .as file that compiled before the reboot and nothing has changed in that file. Specifically, I'm getting error 1046: Type was not found or was not a compile-time constant: Point. I've checked, and sure enough, I have an "import flash.geom.Point" line in with the other imports.
    Ok, now here's the truly odd part: if I change the player from AIR for iOS to AIR 3.0, it compiles just fine. I get the same error, however, when the player is AIR for Android.
    Anybody experienced/fixed this or am I re-installing Flash?

    I've been poking around trying to fix this, and I discovered something... the error occurs on this line of code:
    public function GetIndexOfPointInVector(PointToFind:Point, VectorArray:Vector.<Point>):int
    If I comment that function out (it's not used in this particular project), I don't get that error anymore, even though there are plenty of other Points in use in that very class. Possibly a problem with Vector typing?
    edit: and now StageOrientationEvent is gone.
    Message was edited by: Sean A Simpson

Maybe you are looking for

  • MacAir OX Mavericks merge contacts with Outlook:Mac 2011

    Can anyone help me merge the contacts within my MacAir running OS Mavericks with Outlook:Mac 2011?  Outlook can't seem to see my contacts and I'm creating duplicate contacts within Outlook.  There must be some way!

  • How to call WCF method from the SSRS 2008 ?

    I am developing the SSRS report and wanted to consume the one method call of the WCF service. Suppose I have a service Url like http:\\localhost\2014\security.svc and wanted to consumestring Encrypt(string data) method from that service. Now I know h

  • Transfer of Retained Earnings to Proprietor/Partner Capital Account

    Dear all, One of my client is a Partnership Firm. After year end closure activities Profit/Loss is calculated in Retained earning Account. Actually this Profit /Loss has to be apportioned to respective Partners capital Account. Pls let me know the pr

  • Convert .mov to flash for web?

    Is there a relatively easy way to convert QT mov to a flash file for use on the web? I have Flash CS3 thanks.

  • I can't install the Skype on my new Sony Xperia Z2

    I can't install the Skype on my new Sony Xperia Z2. WHY? Nie mogę zainstalować Skype na moim Sony Xperia Z2. Dlaczego. Potrzebuję i to szybko mieć dostęp. Dużo używam Skype.