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

stage.nativeWindow.width how to call

Community Beginner ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

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()

}

Views

265

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

thank you helped much

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

You're welcome!

Votes

Translate

Translate

Report

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