views:

46

answers:

2

hello 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 one how can i do that ?

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

antpaw
hi thanks for your answer but you got it wrongI have an SWF (( called A)) i want it load another SWF (( called B)) now i want A dimensions to be same as B
From.ME.to.YOU
A: 

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.

poke