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

stage.nativeWindow.width how to call

Community Beginner ,
Dec 20, 2018 Dec 20, 2018

I have called this in a On a ENTER_FRAME event and it works but it causes my program to be buggy so I want call it only when someone resizes the window is there any way to do this

function sizewidth() {

if(stage.nativeWindow.width >800){

BIG()

}

if(stage.nativeWindow.width <800){

SMALL()

}

}

//addEventListener(Event.ENTER_FRAME, onEnter, false, 0, true);

function onEnter(evt:Event):void {

sizewidth()

}

356
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 ,
Dec 21, 2018 Dec 21, 2018

Hi.

Add a NativeWindowBoundsEvent.RESIZING event listener.

import flash.events.NativeWindowBoundsEvent;

function windowResizeHandler(e:NativeWindowBoundsEvent):void

{

    trace(stage.nativeWindow.width, stage.nativeWindow.height);

}

stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZING, windowResizeHandler);

I hope this helps.

Regards.

JC

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 Beginner ,
Dec 21, 2018 Dec 21, 2018

thank you helped much

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 ,
Dec 21, 2018 Dec 21, 2018
LATEST

You're welcome!

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