designFanatic
06-20-2008, 01:10 AM
Hey,
I'm currently programming a site available to see at:
http://biddleinc.ca/empiregrill/
The problem i have is that when I load in external .swf files which are bigger than the main centered movieClip (centeredContent_mc)... if you resize the browser it will bump the center section to a new position because it's size has changed. You can see this in the "Take a tour" section.
This is the code im using:
Stage.scaleMode = "noScale";
Stage.align = "TL";
var stageListener: Object = new Object();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);
function positionContent():Void
{
centeredContent_mc._x = Stage.width/2 - centeredContent_mc._width/2;
centeredContent_mc._y = Stage.height/2 - centeredContent_mc._height/2;
if ( Stage.height/Stage.width > background_mc._height / background_mc._width )
{
var ratio = background_mc._width/background_mc._height;
if ( Stage.height > 400 )
{
background_mc._height = Stage.height;
background_mc._width = Stage.height*ratio;
}
}
else
{
var ratio = background_mc._height/background_mc._width;
if ( Stage.width > 400 )
{
background_mc._width = Stage.width;
background_mc._height = Stage.width*ratio;
}
}
}
positionContent();
My question is: Is there any way to specify the new movieClip and keep if from changing the size of the mc it's being loaded into?
I would GREATLY appreciate any comments!!!!
I'm currently programming a site available to see at:
http://biddleinc.ca/empiregrill/
The problem i have is that when I load in external .swf files which are bigger than the main centered movieClip (centeredContent_mc)... if you resize the browser it will bump the center section to a new position because it's size has changed. You can see this in the "Take a tour" section.
This is the code im using:
Stage.scaleMode = "noScale";
Stage.align = "TL";
var stageListener: Object = new Object();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);
function positionContent():Void
{
centeredContent_mc._x = Stage.width/2 - centeredContent_mc._width/2;
centeredContent_mc._y = Stage.height/2 - centeredContent_mc._height/2;
if ( Stage.height/Stage.width > background_mc._height / background_mc._width )
{
var ratio = background_mc._width/background_mc._height;
if ( Stage.height > 400 )
{
background_mc._height = Stage.height;
background_mc._width = Stage.height*ratio;
}
}
else
{
var ratio = background_mc._height/background_mc._width;
if ( Stage.width > 400 )
{
background_mc._width = Stage.width;
background_mc._height = Stage.width*ratio;
}
}
}
positionContent();
My question is: Is there any way to specify the new movieClip and keep if from changing the size of the mc it's being loaded into?
I would GREATLY appreciate any comments!!!!