1

I'm working on a Flash game, and it renders fine on most browsers and machines. However, when I run the game in Firefox on a Microsoft Surface Pro tablet, the SWF appears to be zoomed out. I can right-click on the game and click on "Show All" and it will return things to normal.

However, my question is how can I stop Firefox (and/or my computer) from doing that? The ideal solution would be something in code that can fix the problem automatically for my users, because I feel like this problem probably comes up with other browser/machine combinations that I haven't encountered yet.

The first thing my program does is call this:

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

Is there any way to tell Flash Player which zoom level it should start with? Or perhaps there's a way to detect what the current zoom level is so that we can respond to it gracefully?

Another option would be to detect the browser's zoom level, but that doesn't seem very feasible, and even if it was, Firefox's is actually set to 100% zoom when this happens, so that wouldn't be very useful.

Community
  • 1
  • 1
  • Are you sure it is not just the browser that is zooming out because maybe the SWF doesn't fit? – putvande Feb 28 '14 at 20:28
  • I just checked, and the browser is definitely set to 100% zoom. Because I've set the `scaleMode` to `NO_SCALE`, zooming in and out through the browser will resize the stage, but it won't actually zoom the SWF. Instead it just keeps everything the same size while the "viewport" changes size. By "viewport" I mean, there's a box in the browser where the SWF is rendered, and all zooming does is change the size of that box without scaling the contents within it. – Livio De La Cruz Feb 28 '14 at 20:46

1 Answers1

1

Apparently, when Flash Player's zoom is altered, it also alters stage.stageWidth and stage.stageHeight. Therefore you can detect that zoom is occurring by comparing those values with the values that you intended.

So a quick fix would be to perform a counter-zoom within your own document class:

scaleX = scaleY = stage.stageWidth / STAGE_WIDTH;

Where STAGE_WIDTH is a constant that stores your intended stage width. I can see no real side-effects of this approach, but you have to make sure that all of your code references STAGE_WIDTH rather than stage.stageWidth.

One noticeable outcome is that bitmap images appear more pixelated, but they appear pixelated even when you hit Show All.