views:

86

answers:

2

Hi, I'm using a Loader object to load an external swf:

var swfLoader:Loader = new Loader();
stage.addChild(swfLoader);
var bgURL:URLRequest = new URLRequest("sometestfile.swf");

swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);

swfLoader.x = 240;
swfLoader.y = 210;

// Resize here?

swfLoader.load(bgURL);
function loadProdComplete(e:Event):void
{
    trace("File loaded");
}

This works fine until I try to set swfLoader.width or .height (as I do when I want to resize loaded images), but in this case the swf isn't displayed anymore. (It's running anyway as I receive traces from sometestfile.swf)

I've resolved my error, using swfLoader.content.width in the Complete event works.

+1  A: 

The loader will have zero width/height until the COMPLETE event fires, so wait until then to set the size. That may solve your problem.

grapefrukt
A: 

You should add stage.addChild(swfLoader); and swfLoader.x = 240; swfLoader.y = 210; and the height and width settings to the loadProdComplete()

daidai