Scaling objects on one axis, and keeping AR.
Hello good people. I've searched this forum and tried to get a solution for my problem for a whole day, but no success. I hope some of you will be willing and able to help me.
What I am trying to do is to make a symbol act like the background movie on this flash site. http://ghost.dk/
So, when I increase the width of the window, the content of the movie zooms in, thus increasing the width of the movie yet keeping the height, but since it zooms in it is decreasing the viewable area.
Maybe im not good at explaining it, but I just want to make a movie playing like that in the background, so that it can be stretched, without loosing aspect ration, yet can be squeezed to a certain point when it starts overlapping. I am talking about the width. Changing height should not change anything, but simply overlap it when the window becomes too small.
The script I tried using was this:
Actionscript Code:
// this tells Flash NOT to allow the assets to be scaled
Stage.scaleMode = "noScale";
Stage.align = "TL";
// need to set up a listener object to say when the stage is resized.
var stageListener:Object = new Object();
Stage.addListener(stageListener);
setBackground();
// called when the stage is resized
stageListener.onResize = function() {
setBackground();
}
function setBackground() {
// determine middle
var middleX = Stage.width/2;
var middleY = Stage.height/2;
// reposition the bkgd to middle
bkgdMC._x = middleX;
bkgdMC._y = middleY;
// scale background to fit width and height
bkgdMC._width = Stage.width;
bkgdMC._height = Stage.height;
// see if it grew bigger horizontally or vertically and adjust other to match
// to maintain aspect ratio
bkgdMC._xscale > bkgdMC._yscale ? bkgdMC._yscale = bkgdMC._xscale : bkgdMC._xscale = bkgdMC._yscale;
}
But it changed stuff even when changing height, like on this site: http://www.minus.dk/
I hope you understand what I want. Just the exact thing like on the first site. Thanx a million in advance!
EDIT: I am using Macromedia Flash 8 and action script 2. But any kind of help would be most welcome.