This is the code I used to retrieve measurements during swf loading and use them to scale bitmaps later, based on bjornson's answer above.
var actualScale :Number; var actualStageWidth :Number; var actualStageHeight :Number; private function collectDimensions () :void { stage.scaleMode = StageScaleMode.NO_SCALE; actualStageWidth = stage.stageWidth; actualStageHeight = stage.stageHeight; var contentWidth :Number = yourVisibleContent.width; var contentHeight :Number = yourVisibleContent.height; var canvasAspectRatio :Number = actualStageWidth / actualStageHeight; var contentAspectRatio :Number = contentWidth / contentHeight; if (canvasAspectRatio > contentAspectRatio) { actualScale = actualStageHeight / contentHeight; } else { actualScale = actualStageWidth / contentWidth; } stage.scaleMode = StageScaleMode.SHOW_ALL; } public function createBitmap (clip :MovieClip) :Bitmap { var bitmapData :BitmapData = new BitmapData(clip.width, clip.height); var matrix :Matrix = new Matrix(); matrix.scale(actualScale, actualScale); bitmapData.draw(clip, matrix); var bitmap :Bitmap = new Bitmap(bitmapData); bitmap.scaleX = bitmap.scaleY = 1/actualScale; bitmap.smoothing = true; return bitmap; }
source share