Problem resizing loader after loading swf

Posted by DanK on Stack Overflow See other posts from Stack Overflow or by DanK
Published on 2010-05-06T10:48:33Z Indexed on 2010/05/14 1:34 UTC
Read the original article Hit count: 293

Filed under:
|
|

I'm using the following code to load an swf in a pure actionscript project (Flex Builder 3)

_loader = new Loader();

_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, Loader_Complete);
_loader.contentLoaderInfo.addEventListener(Event.INIT, Loader_Init);

var request:URLRequest = new URLRequest("Skins/TestSkin.swf");
_loader.load(request);

this.addChild(_loader);

This works okay and displays the swf on the stage (500x375 for some reason - not sure why, TestSkin.swf is a flex app with no defined width and height)

However, when I try to scale the swf so that it will fill the stage, I have problems.

I have tried:

  • Setting _loader.width and _loader.height in my Loader_Complete handler
  • Setting _loader.width and _loader.height in my Loader_Init handler
  • Setting _loader.content.width and loader.content.height in my Loader_Complete handler
  • Setting _loader.content.width and loader.content.height in my Loader_Init handler

I have seen examples online where people say these work for them but whenever I set width or height in any of these ways, the loaded swf is simply not displayed at all.

Any idea what could be causing this?

What is the correct way to resize an swf that has been loaded with a Loader object?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about loader