i'm making an swf file that will load another swf file
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("1.swf");
myLoader.load(url);
i want to edit the main SWF dimensions to be same as the loaded on开发者_高级运维e how can i do that ?
You can access the stage dimensions with Stage.stageWidth and Stage.stageHeight. You might also want to look at Stage.scaleMode as that affects how the stage's size is interpreted when displaying the flash movie inside a bigger container (or fullscreen).
Otherwise the main movie's size is determined by the actual displaying flash player (being in a browser, standalone or via AIR), so you cannot really change it after then movie is actually loaded. You might want to look at resizing B
instead to fit the maximum displayed area of A
.
try this
var l:Loader = new Loader();
addChild(l);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("1.swf"));
function done(e:Event):void{
l.width = this.width;
l.height = this.height;
// OR
l.width = 100;
l.height = 100;
}
this script will not help you if your flash is fullscreen and the user resizes the stage
精彩评论