Remember that the object.height and object.width refers to the active content on the object depending on how you're importing it:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.display.MovieClip;
function startLoad()
{
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("test.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
}
function onCompleteHandler(loadEvent:Event)
{
var object:MovieClip = loadEvent.currentTarget.content;
object.x = stage.x;
object.y = stage.y;
trace(object.width);
trace(stage.stageWidth);
object.width = stage.stageWidth;
trace(object.height);
trace(stage.stageHeight);
addChild(object);
}
function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}
startLoad();
That code above works, but you may be stretching the width to the point where the content is being stretched out of the scene, trace the width and height.
EDIT:
for youtube it would be something like this:
var loader:Loader = new Loader(); - global variable
function initialzer(){
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
}
private function onLoadInit(event:Event){
addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
loader.content.addEventListener("onError", onPlayerError);
}
function onPlayerReady(event:Event):void {
player = loader.content;
player.width = 111;
player.height = 111;
}