his isn’t as simple as it seems. Basically, I’m loading an external swf that calls an XML file and plays a slideshow animation that enlarges or contracts the pics being loaded (similar to a Ken Burns effect).
The external swf is loaded into a movieclip holder named “mc” on the main fla file. The movieclip holder’s dimensions initially, are the same as the fla file. However, I want the loaded swf to scale proportionally according to the stage after it gets resized. So, if I click and drag the stage so that it is wider, the movieclip holder’s width also widens, but it’s height scales proportionally.
If the externally loaded swf had content that fit the stage exactly, without any hidden objects offstage, the movieclip playing on the main fla scales proportionally without any problem.
So far, so good.
Problem, since the externally loaded swf is animated with pics that get bigger or smaller, or even pan from left to right, the size of the movieclip on the main fla file resizes NOT according to the movieclip holder’s width and height, but to it’s content’s width and height that are constantly changing.
I think you can guess my question now. How can I get the movieclip holder to resize proportionally according to it’s own width and height, and not it’s content’s width and height?
Here’s the code I have so far. Note that I created a movieclip called “mc” on the main fla file.
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.*;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var swf:URLRequest = new URLRequest("profile_slide.swf");
var myloader:Loader = new Loader();
myloader.load(swf);
mc.addChild(myloader);
stage.addEventListener(Event.RESIZE, resizeListener);
function resizeListener(e:Event):void {
if (stage.stageWidth > stage.stageHeight) {
mc.width = stage.stageWidth;
mc.scaleY = mc.scaleX;
} else {
mc.height = stage.stageHeight;
mc.scaleX = mc.scaleY;
}
trace(mc.width);
trace(mc.height);
}