简体   繁体   English

Flex Air Open New NativeWindow空对象

[英]flex air open new nativewindow null objecthen

i add a new window in windowapplication,i did by nativeWindow,but when i debug this,the new window's content is always not loading completely. 我在windowapplication中添加了一个新窗口,这是nativeWindow所做的,但是当我调试此窗口时,新窗口的内容始终未完全加载。 the following is the error TypeError: Error #1009: Cannot access a property or method of a null object reference. 以下是错误TypeError:错误#1009:无法访问空对象引用的属性或方法。

i did add the creation_complete event,but it still not work. 我确实添加了creation_complete事件,但仍然无法正常工作。 why?someone could help? 为什么?有人可以帮助您?

opts = new NativeWindowInitOptions();
opts.resizable=false;
opts.maximizable=false;
win = new NativeWindow(opts);
win.alwaysInFront=true;

var newWindow:TestWindow=new TestWindow();
newWindow.addEventListener(FlexEvent.CREATION_COMPLETE,performWindowComplete);
win.activate();

public function performWindowComplete(e:FlexEvent):void
{
     win.stage.addChild(e.currentTarget as TestWindow);
}

and in the TestWindow ,I just add one textArea,when i open this new window,i click the textarea,it throws null object.i confused. 然后在TestWindow中,我只添加一个textArea,当我打开这个新窗口时,我单击了textarea,它会抛出null对象。

CREATION_COMPLETE event never fire because your component not added in display list/stage.First you need to add to display list. CREATION_COMPLETE事件永远不会触发,因为您的组件未添加到显示列表/阶段中。首先,您需要添加到显示列表中。

opts = new NativeWindowInitOptions();
opts.resizable=false;
opts.maximizable=false;
win = new NativeWindow(opts);
win.alwaysInFront=true;

var newWindow:TestWindow=new TestWindow();
newWindow.addEventListener(FlexEvent.CREATION_COMPLETE,performWindowComplete);
win.addElement(newWindow); //Todo
win.activate(); //or Set visible = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM