Per determining the bounds of a masked SWF, use BitmapData
.
For example, I've created a 400x400 swf that's masked to 200x200 starting at 100x100 (download)

Loading this SWF would report 400x400 as width / height.
To obtain the visible bounds of the unmasked content, you could implement:
package
{
import flash.display.BitmapData;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.net.URLRequest;
[SWF(width = 400, height = 400, backgroundColor = 0xefefef, frameRate = 60)]
public class X extends Sprite
{
private var loader:Loader;
public function X()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
loader = new Loader();
var url:URLRequest = new URLRequest("http://jasonsturges.com/labs/stack-overflow/examples/swf-mask/masked.swf");
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.load(url);
}
protected function completeHandler(event:Event):void
{
var bitmapData:BitmapData = new BitmapData(loader.width, loader.height, true, 0);
bitmapData.draw(loader);
var bounds:Rectangle = bitmapData.getColorBoundsRect(0xff000000, 0xff000000, true);
trace(bounds);
}
}
}
Which reports:
(x=100, y=100, w=200, h=200)
So, the visible content is 200x200 starting at 100x100.
Per sizing to the stage, you need to determine what your constraint is to avoid blank / empty regions on the stage.
This can be implemented using a ratio variable:
var ratio:Number = 1.0;
Proportional scaling (by width):
var ratio:Number = stage.stageWidth / bounds.width;
loader.scaleX = ratio;
loader.scaleY = ratio;
loader.x = -(bounds.x * ratio);
loader.y = -(bounds.y * ratio);
Stretch display object to fit stage:
ader.scaleX = stage.stageWidth / bounds.width;
loader.scaleY = stage.stageHeight / bounds.height;
loader.x = -(bounds.x * (stage.stageWidth / bounds.width));
loader.y = -(bounds.y * (stage.stageHeight / bounds.height));
So, all together, to fit the loaded content stretched to fill the entire stage accounting for mask offset:
package
{
import flash.display.BitmapData;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.net.URLRequest;
[SWF(percentWidth = 100, percentHeight = 100, backgroundColor = 0xefefef, frameRate = 60)]
public class X extends Sprite
{
private var loader:Loader;
public function X()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
loader = new Loader();
var url:URLRequest = new URLRequest("http://jasonsturges.com/labs/stack-overflow/examples/swf-mask/masked.swf");
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.load(url);
}
protected function completeHandler(event:Event):void
{
var bitmapData:BitmapData = new BitmapData(loader.width, loader.height, true, 0);
bitmapData.draw(loader);
var bounds:Rectangle = bitmapData.getColorBoundsRect(0xff000000, 0xff000000, true);
trace(bounds);
addChild(loader);
loader.scaleX = stage.stageWidth / bounds.width;
loader.scaleY = stage.stageHeight / bounds.height;
loader.x = -(bounds.x * (stage.stageWidth / bounds.width));
loader.y = -(bounds.y * (stage.stageHeight / bounds.height));
}
}
}