Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In your case it would probably be easier to use StageScaleMode.NO_SCALE and to code the resizing yourself:</p> <pre><code>stage.addEventListener(Event.RESIZE, onStageResize); private function onStageResize(event : Event) : void { var stageW : int = stage.stageWidth; var stageH : int = stage.stageHeight; var contentW : int = yourVisibleContent.width; var contentH : int = yourVisibleContent.height; // resize it to fit var canvasAspectRatio : Number = stageW / stageH; var contentAspectRatio : Number = contentW / contentH; if(canvasAspectRatio &gt; contentAspectRatio) { yourVisibleContent.height = stageH; yourVisibleContent.width = yourVisibleContent.height * contentAspectRatio; } else { yourVisibleContent.width = stageW; yourVisibleContent.height = yourVisibleContent.width / contentAspectRatio; } // center it: yourVisibleContent.x = (stageW - yourVisibleContent.width) / 2; yourVisibleContent.y = (stageH - yourVisibleContent.height) / 2; // fill remaining space with black: graphics.beginFill(0x000000); if(canvasAspectRatio &gt; contentAspectRatio) { var horizontalEmptySpace : Number = stageW - yourVisibleContent.width; graphics.drawRect(0, 0, horizontalEmptySpace / 2, stageH); graphics.drawRect(stageW - horizontalEmptySpace / 2, 0, horizontalEmptySpace / 2, stageH); }else{ var verticalEmptySpace : Number = stageH - yourVisibleContent.height; graphics.drawRect(0, 0, stageW, verticalEmptySpace / 2); graphics.drawRect(0, stageH - verticalEmptySpace / 2, stageW, verticalEmptySpace / 2); } // now you can also redraw your bitmaps with higher resolutions // it is easy to read the scale of your content with: yourVisibleContent.scaleX and yourVisibleContent.scaleY } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload