Last active
December 25, 2015 13:29
-
-
Save SnugglePilot/6984043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onStageResize(e:Event) { | |
// Not pictured: backdrop is a Sprite that has .addChild(new Bitmap()) graphics contained. | |
// Using Haxe3 + openFL 1.0 | |
if (stage.stageWidth > stage.stageHeight) { | |
// This always works: | |
backdrop.rotation = 0; | |
backdrop.x = 0; | |
backdrop.y = 0; | |
backdrop.width = stage.stageWidth; | |
backdrop.height = stage.stageHeight; | |
} else { | |
backdrop.rotation = 0; | |
// The above line should not be necessary. But without it, the following two lines do not take effect: | |
backdrop.width = stage.stageHeight; | |
backdrop.height = stage.stageWidth; | |
// Probably because the backdrop rotation was triggered on a previous tick. | |
backdrop.rotation = 90; | |
// (Handle top left registration point:) | |
backdrop.x = stage.stageWidth; | |
backdrop.y = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment