I'm developing a Flash game using ActionScript 3 and have this code in my documents class:
package com {
import flash.display.MovieClip;
import flash.display.Stage;
public class Engine extends MovieClip {
public function Engine() {
// Create a player instance
var player:Player = new Player();
addChild(player);
// Start the game loop
addEventListener(Event.ENTER_FRAME, this.gameLoop);
}
public function gameLoop(event:Event) {
trace("hello world");
}
}
}
When I run the game, however, I don't get any output and instead get this error message:
C:\Users\MyName\Dropbox\Uni\DAT104\flash\com\Engine.as, Line 15 1046: Type was not found or was not a compile-time constant: Event.
Is there a library or something I need to import to get this to work? If it's not obvious, I want to run the gameLoop method of my Engine class (the documents class) on every new frame (the document is currently set to 30fps).
Thanks!