Skip to main content
May 16, 2012
Question

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

  • May 16, 2012
  • 2 replies
  • 10098 views

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 4341046: 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

This topic has been closed for replies.

2 replies

kiran1989
Inspiring
May 17, 2012

If you getting compile time events error

please imort all events

import flash.events.* like this

May 17, 2012

If you getting compile time events error

please imort all events

import flash.events.* like this

Made absolutely no difference (other than making line 434 line 435).

sinious
Legend
May 17, 2012

Post the full code. Your probably is obviously on a previous line that has spilled into the line it finally gives up on. Use www.pastebin.com

Ned Murphy
Legend
May 16, 2012

What is line 434?

May 17, 2012

Line 434 = function trackPosition (event:Event)

Ned Murphy
Legend
May 17, 2012

There is nothing wrong with the lines of code as you have them written, so the problem lies elsewhere.  If you haven't doublechecked, make sure your publish settings are set for AS3.  Otherwise, there could be an error in some other line that is leading up to line 434.