I’m trying to get my Flash build to use the entire window of the browser as the stage. My game runs in full screen on Mac and Windows, calculates the best-fitting whole number scale for drawing everything, and then calculates X and Y offsets for the game “screen”. I want this behavior to work in Flash, calculating everything for when the player launches the game in browser, but I don’t know what values to set in the
<window> element. I’ve tried these:
- width=0 height=0
- width=0 height=0 fullscreen=true
So now it’s using some default values of 800x600. I don’t know where those values have come from, but they seem to be the default for Mac and Windows targets as well if you don’t overwrite the width and height values.
Does anybody know how to do this for Flash?
You’ll want to try doing a custom HTML template for the Flash content, when you do
openfl test flash -web it generates a template using SWFObject. This might already support fullscreen, or you might use this as a starting point for your own template.
The Flash movie has to be compiled with “some” size, but in HTML, it can be embedded/resized at will. It sounds like you want the Flash build to work similarly to how we do HTML5 right now. It would be nice to have the
flash -web output work similarly if it does not already
Wow, you guys really have everything! Awesome HTML page to start with, thanks!!
OK it wasn’t working last night, but I tried again to just change the style for the
nme-application element so that the width and height are 100% instead of the pixel values coming from the project.xml’s
<window> element. Beautiful!
I’ll see if I can find and modify the HTML generator to make that change. If anybody has a hint to where it is, please chime in
You might compare with the “templates/html5/template/index.html” file, I believe there might be something like this:
::if (WINDOW_WIDTH == 0)::width="100%"::end:: ::if (WINDOW_HEIGHT == 0)::height="100%"::end::
The template gets processed, so if you have a 0x0 window, it sets the CSS for a full stretching window. Otherwise, it allows it to be a normal pixel size
But at some point before it gets to there,
WINDOW_HEIGHT seem to be set to 800 and 600 respectively if those parameters are both 0. I thought that modifying the index.html at templates/flash/templates/web such that the width and height are 100% would work, but it does not.
So I have to manually set them to be both 100%. I have no idea about the flow up to that point when compiling, so I’m going to move on.
OK now it isn’t working again when I set them to 100%… It’s defaulting to 800x600 again, regardless of the size of my browser window. I don’t get it