Problems with Stage Fullscreen

I created a Tilemap object, using stage.stageWidth and stage.stageHeight as it’s size constraints. When I rendered my tiles, only about half of the stage was actually filled with the tiles, and when I moved into fullscreen, no more tiles were rendered. The strange part about this is that the outermost tiles are cut off short. As a test, I tried replacing the stage.stageWidth and stage.stageHeight with the dimensions of my display. Now when I turn to full screen most of the tiles render, but there is still a chunk of them missing from the right side of the screen, and increasing the width value doesn’t fill it in any more.

Is there a way that I could get an accurate stage width/height value for fullscreen mode that depends on the machine being used? because obviously my display won’t be the same size as someone else’s.

Here are 3 screenshots for each of the issues I described:

stage.stageWidth and stage.stageHeight filling half of the normal screen:

stage.stageWidth and stage.stageHeight filling half of the normal screen, put into fullscreen:

stage.stageWidth and stage.stageHeight replaced with custom values, put into fullscreen:

Thanks for any insight.

Can you try and listen to stage.addEventListener(Event.RESIZE, onResize) and set the Tilemap width and height when that changes?

I’m still a bit confused as to how to run the code I want when the event is “heard.”

I did:

	stage.addEventListener(Event.RESIZE, onResize);
	function onResize(e): Void {
		SCREEN_WIDTH = stage.stageWidth;
		SCREEN_HEIGHT = stage.stageHeight;
	}

Isn’t the second argument to the addEventListener method supposed to be a function that is to be run when the event is “heard?” Because I keep getting the errors:

Source/Main.hx:39: characters 39-47 : Unknown identifier : onResize
Source/Main.hx:39: characters 39-47 : For function argument 'listener’

and I’m starting to second guess myself.

You could try:

stage.addEventListener(Event.RESIZE, function(e) {
	SCREEN_WIDTH = stage.stageWidth;
	SCREEN_HEIGHT = stage.stageHeight;
});

or put onResize before the addEventListener call or make it a class-level method