пример, который наверно все видели Мук ас3 стр.270
класс Game
Код AS3:
package {
import flash.events.*;
import flash.utils.*;
public class Game extends EventDispatcher {
public static const GAME_0VER:String="gameOver";
public function Game( ) {
var timer:Timer=new Timer(1000,1);
timer.addEventListener(TimerEvent.TIMER, timerListener);
timer.start( );
function timerListener(e:TimerEvent):void {
endGame( );
}
}
private function endGame( ):void {
dispatchEvent(new Event(Game.GAME_0VER));
}
}
}
класс Console
Код AS3:
package {
import flash.display.*;
import flash.events.*;
public class Console extends Sprite {
public function Console( ) {
var game:Game = new Game( );
game.addEventListener(Game.GAME_OVER, gameOverListener);
}
private function gameOverListener(e:Event):void {
trace('The game has ended!');
}
}
}
основной класс Main
Код AS3:
package {
import flash.display.*;
public class Main extends MovieClip{
public function Main() {
var console:Console = new Console();
var game:Game = new Game();
}
}
}
выдает ошибку Console.as, line 7 1119:Acces of possibly undefined property GAME_OVER through a reference with static type Class.
Как заставить его работать?