0
votes

im trying to load external swf file with bigger size to my main swf. but i cant find any code for it. i manage to load the external swf but not the size i wanted any help pls...my main stage size is width 600 height 100.

import fl.containers.UILoader;

var MyLoader:UILoader = new UILoader();

MyLoader.autoLoad=true;
MyLoader.load();
MyLoader.source ="scene2.swf";
MyLoader.scaleContent = false;
MyLoader.move(0, 0);
MyLoader.width = 600;
MyLoader.height = 300;


addChild(MyLoader);



MyLoader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event) {
trace("File loaded! " + MyLoader.bytesLoaded + " bytes");

}

Any help on what is going wrong would be greatly appreciated!!!!!! thanks

3

3 Answers

0
votes

Do not set the loader width and height, finish the loading first and only then - in your completeHandler - add it to displaylist (addChild) and only after that change the size. Is it what you mean?

0
votes

I think there should be no use of UILoader here. The write class is URLLoader and URLRequest. Like this:

import flash.display.DisplayObject;

import flash.net.URLLoader ;
import flash.net.URLRequest ; 

var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("scene2.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);

mLoader.load(mRequest);


function onCompleteHandler(loadEvent:Event)
{
        addChild(loadEvent.currentTarget.content);
}
0
votes

Just remove MyLoader.scaleContent = false; code.