Thread: [Actionscript 3] loading extern .swf
View Single Post

  #7 (permalink)  
Old 09-07-08, 21:12
xInstinct's Avatar
xInstinct xInstinct is offline
Flasher
 
Join Date: Jun 2008
Location: Texas
Posts: 42
Rep Power: 0
xInstinct is on a distinguished road
Send a message via AIM to xInstinct
Re: loading extern .swf

Alright, the resizing is actually a problem...

if you took your ldr...
Code:
ldr.width = 100;
ldr.height = 100;
It won't work, right?
However, this works by scaling the loaded SWF file by 50%;
Code:
ldr.scaleY = 0.5;
ldr.scaleX = 0.5;
But that can affect the quality of your SWF file...
So what about making a Sprite, or a MovieClip, and loading the SWF file into that:
Code:
var mySprite = new Sprite();
mySprite.x = mySprite.y = 15;
mySprite.width = mySprite.height = 200;
addChild(mySprite);

// In the function //
mySprite.addChild(ldr)
//  end function //
That didn't work for me either...
So, I went to the stage, drew a rectangle the width and height I wanted, and converted it to a movieclip, Also exporting it to ActionScript 3! So now you have the movieclip in your library, and it is the width and height you want!

So say you made your movieclip and called it "holder"
then you can do this;
Code:
var myMC:holder = new holder()
myMC.x = myMC.y = 15; 
// If you want to change height
// or width again, then...
// myMC.width = myMC.height = 200
addChild(myMC);

// in the function //
myMC.addChild(ldr);
// end function //
Should work, it just worked for me (my code is a bit different though as my project is different, but same concept)

xInstinct.
Reply With Quote