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

New NativeWindow with owner defined fails to display

Explorer ,
Apr 20, 2019 Apr 20, 2019

Copy link to clipboard

Copied

This seems like a no-brainer, but I'm stumped over the simplest thing. Am I misunderstanding the owner property?

I had an issue in my application creating a new NativeWindow with the owner defined. The window would not show up when activate() was invoked on it. So I created the simplest hello world application to ensure it wasn't something in my code and it still doesn't show. Can anyone help me figure out what I'm missing or explain the owner property as to why it's not working? If I comment out the line setting the owner on the NativeWindowInitOptions then the new window displays as expected.

package
{

   import flash.display.NativeWindow;
   import flash.display.NativeWindowInitOptions;
   import flash.display.Sprite;
   import flash.text.TextField;

   public class Main extends Sprite

   {
   public function Main()
  {
   var textField:TextField = new TextField();
   textField.text = "Hello, World";
   addChild(textField);

   var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
   initOptions.owner = stage.nativeWindow;

   new NativeWindow(initOptions).activate();
   }
  }
}

TOPICS
Development

Views

652

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

correct answers 1 Correct answer

Engaged , Apr 21, 2019 Apr 21, 2019

package {

import flash.display.NativeWindow;
import flash.display.NativeWindowInitOptions;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;

public class Main extends Sprite {
    public function Main() {
        var textField:TextField = new TextField();
        textField.text = "Hello, World";
        addChild(textField);
        this.addEventListener(Event.ADDED, onAdded)
    }

    private function onAdded(event:Event):void {
        stage.nativeWindow.activate(); //activ

...

Votes

Translate

Translate
Engaged ,
Apr 21, 2019 Apr 21, 2019

Copy link to clipboard

Copied

package {

import flash.display.NativeWindow;
import flash.display.NativeWindowInitOptions;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;

public class Main extends Sprite {
    public function Main() {
        var textField:TextField = new TextField();
        textField.text = "Hello, World";
        addChild(textField);
        this.addEventListener(Event.ADDED, onAdded)
    }

    private function onAdded(event:Event):void {
        stage.nativeWindow.activate(); //activate the stage window before setting as owner
        var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
        initOptions.owner = stage.nativeWindow;
        var newWindow:NativeWindow = new NativeWindow(initOptions);
        newWindow.width = 200;
        newWindow.height = 200;
        newWindow.activate();
    }
}
}

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
Explorer ,
Apr 21, 2019 Apr 21, 2019

Copy link to clipboard

Copied

LATEST

Thank you, that worked like a charm.

Is there any documentation anywhere that says this needs to be done? That's a pretty big oversight if not, but I'm not sure if I just wasn't seeing it or reading something right.

Thanks again for your help,

Kyle

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