haxenme/nme

Window close events

codeservice opened this issue · 0 comments

public function close()

Can we have cancelable and non cancel able version of closing window events? As I found out, its good to have both types.

`public function close(): Bool
{
if (stage!=null)
{
var evt_before: nme.events.Event = new nme.events.Event(nme.events.Event.BEFORE_CLOSE, false, true);
stage.dispatchEvent(evt_before);
if(evt_before.nmeGetIsCancelled())
return false;

     var evt_after: nme.events.Event = new nme.events.Event(nme.events.Event.CLOSE, false, false);
     stage.dispatchEvent(evt_after);

     stage.dispose();
     stage = null;
  }
  nme_window_close(nmeHandle);
  NativeResource.dispose(nmeHandle);

  return true;

}`