How to execute code before closing the application? I tried:

import flash.display.*; import flash.events.*; stage.nativeWindow.addEventListener(Event.CLOSING, onClosing); function onClosing(e:Event):void { e.preventDefault(); trace('работает!'); } 

It produces errors:

 1119: Access of possibly undefined property NativeWindow through a reference with static typeflash.display:Stage. 1119: Access of possibly undefined property CLOSING through a reference with static type Class. 

What is the matter I can not understand.
ActionScript 3, Flash Player 11.2.

  • nativeWindow with a little one - ShockWave
  • Nothing changed. - Nitive
  • do you have an AIR app? Checked NativeWindow.isSupported? It only works on desktop AIR applications. help.adobe.com/ru_RU/FlashPlatform/reference/actionscript/3/… - ShockWave
  • No, I do not have an AIR application. Are there ways for Flash Player 11.2? - Nitive
  • Ways what? Intercept the event of closing the browser window? Not. - ShockWave

1 answer 1

In the settings of the publication, I changed Flash Player 11.2 to AIR 2.5. In Flash, everything works fine, but not in the browser on the server. And it seems it will not.

  • NativeWindow class in web player is not available. - ShockWave