private function onClick(evt:MouseEvent):Void
{
var secondWindow = new openfl.display.Window ();
secondWindow.width = 400;
secondWindow.height = 300;
secondWindow.x = 100;
secondWindow.y = 100;
secondWindow.resizable = true;
Lib.current.stage.application.addWindow (secondWindow); //secondWindow.stage.addChild(_bgSprite);
secondWindow.renderer.onRender.add(winRenderer);
}
private function winRenderer(): Void
{
var secondWindow = new openfl.display.Window ();
secondWindow.stage.addChild(_bgSprite);
}
I can not understand why openfl.display.Window() always crashed if i open new window than application stopped to work. How do i fix it? I really want secound window.
Youāre right ā I just found out that the window.renderer was not getting removed on close, I just updated Lime and it appears to be stable, but let me know what happens on your side, thanks
I try debug version of build - now it found āNull Object Referenceā
If you open second window and application shows messagebox āNull Object Referenceā.
If i copy of your code for example:
class Main extends Sprite {
public function new () {
super ();
var sprite = new Sprite ();
sprite.graphics.beginFill (0xFF0000);
sprite.graphics.drawRect (0, 0, 100, 100);
addChild (sprite);
sprite.addEventListener (MouseEvent.MOUSE_DOWN, function (_) {
var window = new Window ();
window.width = 400;
window.height = 300;
window.renderer.onRender.add (function () {
window.stage.color = Std.int (Math.random () * 0xFFFFFF);
});
stage.application.createWindow (window);
});
}
}
It means shows error message āNull Object Referenceā
I have tried fixed āonCreateā in window.onCreate but it shows after opening second window and shows error message āNull Object Referenceā
private function onClick(evt:MouseEvent):Void
{
var window = new Window ();
window.width = 400;
window.height = 300;
// Edit
Possible use with NME?? I donāt understand what do I with nme.app.Window
But it is hard to understand
For what beginRender and endRender???
nme.Lib.create(); sees like lime but it sees inFrameLoaded what is that?
It has onRender and onCreate but i can not get inFrameloaded:Dymanic.
If you import lime.app.Window, it will not have a stage property. openfl.display.Window extends lime.app.Window with automatic stage creation per window.
As for NME, I donāt really know ā the Lime API is totally unrelated to the NME API, Iām not sure what nme.app.Window does.
I am now - Thanks for working solution - your code was correct to 3.2.1 That is why you have fixed renderer.add ā¦ I say thanks for fixedā¦ I will work nowā¦
// Edit:
Sadly no types like Adobe Air types example standard, lightweight or utility and window should always front or back. Please add new features Windowās featuresā¦ Thanks!
PS: I found lime-gtk wow nice but I didnāt test it
If i use Haxe-UI Core example with windowing but it is possible because user clicks button and application opens window ( just use modalable mode like owned window or 2. window need to make complete than back to main window like creating application from Visual Studio XXXX )
I hope you have to prepare new features like Adobe Airās NativeWindow features. Thanks for next release Lime 3.3 and Openfl 4.3??
I am sorry, to open this topic again. But I am not getting along with it. I am trying for two days in vainā¦
I have done as you said (see above).
My problem is, that the displayObjects arenāt displayed and the event onRender is not thrown, so the renderCallBackFn() is not executed.
I have had to add
var renderer : Renderer = new Renderer( window );
to your code example (otherwise the window.renderer.onRender.add () would throw a null-pointer exception).
I have noticed that by default the renderer is set to cairo. I have even got the renderer.type and the renderer.context from the Lib.current [ā¦] and I have set in window.renderer accordingly.
It didnāt change anything.
I only get a white window with no displayObjects shown. But the displayObjects can be found in within the correct hierarchy at Lib.current.
Lime 6.x was more complicated for creating a new window, I think you need to at least call createWindow as well as addWindow, and additional wiring might be needed
Updating to Lime 7.0 still is a problem, as I havenāt got a reply of Eric Brishton, yet, concerning the issue with the hxcpp-debugger interference with the latest Lime/ OpenFl version.
Of cause, I could comment the critical line out, that starts the debugger out and set the OpenFl/ Lime version up and down, when ever I have to use the debugger or the second window. Using both at a time, would then be impossible.
Anyhow, I would prefer the most simple solution, even if it is only a workaround for the time being.
How would I use createWindow() then? Is it meant to be a solution for my constellation (Lime 6.4.0)?
I do not want to waste your time, no more. I assume, that finding the perfect workaround, would take much more efforts. I will wait until the debugger will be fixed (which hopefully will be soon). Then I can update to the current Lime and OpenFl version without any disturbances.
At the moment the content of the second window is represented in a sprite. For the time being, this will be my workaround.