views:

30

answers:

1

I'm working on one current project, I don't have any issues to load a SWF into a main SWF but I can't figure out how to apply dynamically the scale down and up into a thumbnail images size while using the Resize event handler to fit in any browsers sizes.

I load SWF into a Loader object then add it into a container => currentMC. I want to size it and keep all the pieces inside this container. Therefore no matter browser size, I just want to be able to apply scale on it to fit it.

Does anyone know how to do that? How would I deal with stageWidth and stageHeight? Any code examples would help me a lot.

A: 

If you can edit the swf you load, put this code inside the LOADED swf:

if (stage==null) { //first we need to wait till the stage is initialized
    addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
} else {
    onAddedToStage();
}

function onAddedToStage(event:Event=null):void {
    stage.addEventListener(Event.RESIZE, updateGUI); //resize something everytime we resize our browser window
    updateGUI(); //resize for the first time
}

function updateGUI(event:Event=null):void {
   //scale what you need
   //you can access the *stage* variable from inside the loaded swf, for eg.
   square.width = stage.stageWidth/4;
}

if not, try to scale the movieclip you load another swf into

VIT
How to scale the movieclip which load another swf dynamically?
Qpixo