Highlighted

New NativeWindow with owner defined fails to display

Explorer ,
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();
   }
  }
}

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

TOPICS
Development

Views

522

Likes

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

New NativeWindow with owner defined fails to display

Explorer ,
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();
   }
  }
}

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

TOPICS
Development

Views

523

Likes

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
Apr 20, 2019 0
Engaged ,
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();
    }
}
}

Likes

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
Reply
Loading...
Apr 21, 2019 0
kamckng LATEST
Explorer ,
Apr 21, 2019

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Apr 21, 2019 0