Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

1119: Access of possibly undefined property nativeWindow through a reference with static type flash.display:Stage.

Contributor ,
Mar 11, 2016 Mar 11, 2016

i was trying this code :

http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7e08.html

but it shows error : 1119: Access of possibly undefined property nativeWindow through a reference with static type flash.display:Stage.

package

{

  import flash.display.Sprite;

  import flash.events.MouseEvent;

  import flash.text.TextField;

  

  public class MinimizeExample extends Sprite

  {

  public function MinimizeExample():void 

  {

  var minTextBtn:TextField = new TextField();

  minTextBtn.x = 10;

  minTextBtn.y = 10;

  minTextBtn.text = "Minimize";

  minTextBtn.background = true;

  minTextBtn.border = true;

  minTextBtn.selectable = false;

  addChild(minTextBtn);

  minTextBtn.addEventListener(MouseEvent.CLICK, onMinimize);

  

  var maxTextBtn:TextField = new TextField();

  maxTextBtn.x = 120;

  maxTextBtn.y = 10;

  maxTextBtn.text = "Maximize";

  maxTextBtn.background = true;

  maxTextBtn.border = true;

  maxTextBtn.selectable = false;

  addChild(maxTextBtn);

  maxTextBtn.addEventListener(MouseEvent.CLICK, onMaximize);

  

  var restoreTextBtn:TextField = new TextField();

  restoreTextBtn.x = 230;

  restoreTextBtn.y = 10;

  restoreTextBtn.text = "Restore";

  restoreTextBtn.background = true;

  restoreTextBtn.border = true;

  restoreTextBtn.selectable = false;

  addChild(restoreTextBtn);

  restoreTextBtn.addEventListener(MouseEvent.CLICK, onRestore);

  

  var closeTextBtn:TextField = new TextField();

  closeTextBtn.x = 340;

  closeTextBtn.y = 10;

  closeTextBtn.text = "Close Window";

  closeTextBtn.background = true;

  closeTextBtn.border = true;

  closeTextBtn.selectable = false;

  addChild(closeTextBtn);

  closeTextBtn.addEventListener(MouseEvent.CLICK, onCloseWindow);

  }

  function onMinimize(event:MouseEvent):void

  {

  this.stage.nativeWindow.minimize();

  }

  function onMaximize(event:MouseEvent):void

  {

  this.stage.nativeWindow.maximize();

  }

  function onRestore(event:MouseEvent):void

  {

  this.stage.nativeWindow.restore();

  }

  function onCloseWindow(event:MouseEvent):void

  {

  this.stage.nativeWindow.close();

  }

  }

}

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 11, 2016 Mar 11, 2016

you can't force-close a browser window except for a window opened with javascript.

Translate
Community Expert ,
Mar 11, 2016 Mar 11, 2016

nativeWindow is only available when publishing for air.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 11, 2016 Mar 11, 2016

when i want to close button . i am using windows 7

it will give me alert ? do you want to quite game ? is that possible for .swf game ? i am not using air for android . its just .swf for windows and website

when.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2016 Mar 11, 2016
LATEST

you can't force-close a browser window except for a window opened with javascript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines