import flash.events.TimerEvent;
import flash.utils.Timer;

class Main {
  static public var _this:Main;
  private var _timer:Timer;
  public var wm:Watermelon;

  static function main() {
    _this = new Main();
  }

  private function new() {
    _timer = new Timer( 40 );
    _timer.addEventListener( TimerEvent.TIMER, isReady );
    _timer.start();
  }

  private function isReady( ?e:TimerEvent = null ):Void {
    if ( flash.Lib.current.stage != null ) {
      if ( Std.is( flash.Lib.current.stage.stageWidth, Int ) &&
           Std.is( flash.Lib.current.stage.stageHeight, Int ) ) {
        _timer.stop();
        wm = new Watermelon();
      }
    }
  }
}
