PDA

View Full Version : Sizing External SWF Proportionately


stefanmumaw
04-21-2008, 11:20 PM
Hi all- I have a Flash site that I am working on that sizes full screen. I have a UILoader element inside a movieclip in that site that is pulling in an external SWF. I need to place that movieclip at the bottom/center of the page, but I need that movieclip to be 80% of the stage width while maintaining the proportionate height of the original SWF being called in. As if that wasn't enough, I need that movieclip to size proportionately to the browser size, always being 80% of the stage width and remaining the proportionate height.

I have other movieclips on the stage that are not sizing but are moving based on the browser resize and they work great. I just can't seem to code the proportionate resize. I have tested and succeeded at sizing it disproportionately as well as not sizing at all and staying centered along the bottom. Just can't seem to find the right combination to get the sizing right. I have the function, scaleMode and event listener written for the other MCs, just need some help on the resize code.

Anyone have any thoughts?

stefanmumaw
04-22-2008, 03:32 AM
I got it working. Sometimes, you just need to ask the question to get the brain moving, huh?

stage.scaleMode = "noScale";

var sizew:Number = (stage.stageWidth-mcLeadership.width)/2;
var sizeh:Number = (stage.stageHeight-mcLeadership.height);
mcLeadership.x = sizew;
mcLeadership.y = sizeh;
mcLeadership.width = stage.stageWidth * .80
mcLeadership.scaleY = mcLeadership.scaleX

function stageListener(e:Event) {

var sizew:Number = (stage.stageWidth-mcLeadership.width)/2;
var sizeh:Number = (stage.stageHeight-mcLeadership.height);
mcLeadership.x = sizew;
mcLeadership.y = sizeh;
mcLeadership.width = stage.stageWidth * .80
mcLeadership.scaleY = mcLeadership.scaleX
}

stage.addEventListener (Event.RESIZE, stageListener);