Stage size issues between different targets (HaxeFlixel)


I’m pretty new to HaxeFlixel and HaxeDevelop. Most recently, I’ve been working a lot in C/C++, Objective-C, and working directly with OpenGL! When a friend of mine introduced HaxeFlixel to me, I was very intrigued by its multi-platform capabilities! Out of that interest I found an interesting discrepancy between the Flash and Windows target platforms when working with the stage’s “resize” function.

Here’s a little bit of code!

package graphics;

import openfl.Lib;

class VideoSettings
	public function setWindowSize(width:Int, height:Int)
		Lib.current.stage.resize(width, height);

After successfully building for Flash, the application calls setWindowSize and crashes with this error:
"Property resize not found on flash.display.Stage and there is no default value."
The same process on Windows works fine, and I assume that will persist on Mac and Linux. At this point, I’m not sure how else to resize the window when building for Flash.

On a different note, the resize callback might result in a very inaccurate stageWidth / stageHeight if you have recently changed your operating system’s display scale. This requires a restart on Windows, I’m not sure the procedure on Mac and Linux, but I know that in my case I had to restart my computer and everything turned out okay in the end regarding stageWidth / stageHeight being accurate.


Do you do this once, or do you do it repeatedly in your application?

Use <window width="" height="" /> in your project.xml to set your desired initial window width and height for both Flash or desktop, and then the user should be able click the corners and drag to resize your window if you handle resize events

HaxeFlixel uses an old version of OpenFL and Lime, current versions have stage.window.resize, which will work on the desktop, but is a non-op (no crash) on Flash Player where its not allowed