Skip to content

Instantly share code, notes, and snippets.

@illuzor
Created January 5, 2014 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save illuzor/8262887 to your computer and use it in GitHub Desktop.
Save illuzor/8262887 to your computer and use it in GitHub Desktop.
var backTexture:SubTexture = atlas.getTexture("menuBackground") as SubTexture;
var clipping:Rectangle = backTexture.clipping;
var uvMatrix:Matrix = new Matrix();
uvMatrix.scale(stage.stageWidth / (backTexture.width * clipping.width), stage.stageHeight / (backTexture.height * clipping.height));
var background:Shape = new Shape();
addChild(background);
background.graphics.beginTextureFill(backTexture, uvMatrix);
background.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
background.graphics.endFill();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment