views:

30

answers:

1

Hi guys I am trying to load an external swf file. The swf width and height is small and I want to enlarge it when loading it. (My scene has large width and height). My current code could load the file but I am not sure how to enlarge the swf width and height. I would appreciate if anyone can help me about it...Thanks

var request:URLRequest = new URLRequest("index.swf");
var loader:Loader = new Loader()
loader.load(request);

addChild(loader);
+3  A: 

The Loader class is a DisplayObject (which is how you can add it to the stage). You should be able to just set the width and height of your loader:

loader.width = 50;
loader.height = 50;

UPDATED: Make sure to read the comments about width vs. scaleX and being loaded or on the stage.

sunetos
Ty sunetos, for some reasons, when I added your code before addChild(loader) and tested the movie, it rendered blank . However, if I took your code out, it worked again..any idea why??Thanks and +1..
Jerry
btw, my external swf is in AC2, but I don't think it matters..
Jerry
Have you changed the value from 50 to a greater one? Maybe you're only seeing a blank part of the loaded movieclip.
jdecuyper
yes i did, I put 1100 and 850...no luck though...
Jerry
Building on jdecuyper's comment, you could always use loader.scaleX and scaleY instead of setting width and height directly.
sunetos
If that's not working, then we might need to see more of your code to figure out what the problem is.
sunetos
thx sunetos...scaleX and scaleY works but was wondering why width and height don't..
Jerry
I have run into issues in the past with setting width and height on objects that are not fully initialized/added to the stage yet. If you want to set them explicitly, you might need to attach an event handler for ADDED_TO_STAGE or LOADED on the loader and then set the width and height.
sunetos
Got you! thanks a lot!
Jerry