FLASH - fill stage
- Started
- Last post
- 10 Responses
- krust
my script aint working.. anyone see why? i want mc_x to fill the stage (unskewed)
Stage.scaleMode = "noScale";
Stage.align = "TL";
listener = new Object();
listener.onResize = function() {
mc_x._width = Stage.width;
mc_x._height = Stage.height;
if (mc_x._xscale>mc_x._yscale) {
mc_x._yscale = mc_x._xscale;
} else {
mc_x._xscale = mc_x._yscale;
}
listener.onResize();
Stage.addListener(listener);
};
- skt0
Try getting your scaling value into variables first before resizing anything.
movieXScale = Stage.width / mc_x._width;
movieYScale = Stage.height / mc_x._height;
if (movieXScale >= movieYScale){
mc_x.width = mc_x.width * movieXScale
mc_x.height = mc_x.height * movieXScale
else{
mc_x.width = mc_x.width * movieYScale
mc_x.height = mc_x.height * movieYScale
}
- krust0
cheers... still doesnt resize tho!
Stage.scaleMode = "noScale";
Stage.align = "TL";
movieXScale = Stage.width/mc_x._width;
movieYScale = Stage.height/mc_x._height;
listener = new Object();
listener.onResize = function() {
if (movieXScale>=movieYScale) {
mc_x.width = mc_x.width*movieXScale;
mc_x.height = mc_x.height*movieXScale;
} else {
mc_x.width = mc_x.width*movieYScale;
mc_x.height = mc_x.height*movieYScale;
}
listener.onResize();
Stage.addListener(listener);
};
stop();
- Jerry0
Stage.scaleMode = "noScale";
Stage.align = "TL";
//
listener = new Object ();
listener.onResize = function () {
trace ("sdfsdf");
mc_x._width = Stage.width;
mc_x._height = Stage.height;
};
//
listener.onResize ();
//
Stage.addListener (listener);
stop ();
- skt0
Try this:
var stageL:Object = new Object();
stageL.onResize = function() {
movieXScale = Stage.width / mc_x._width;
movieYScale = Stage.height / mc_x._height;if (movieXScale>=movieY Scale) {
mc_x.width = mc_x.width * movieXScale;
mc_x.height = mc_x.height * movieXScale;
} else {
mc_x.width = mc_x.width * movieYScale;
mc_x.height = mc_x.height * movieYScale;
}Stage.addListener(stageL);
- skt0
NT has added some spaces by the way.
- krust0
thanks dude... i'll give that a go..
what's this bit about tho?trace ("sdfsdf");
?
- Jerry0
ow sorry, it was to check if the stage was actually listening, hahahaha. You can remove it of course, cheers man
- krust0
ahhhhhhhhhrrrrgh!
ok, jerry, your way works, except the image gets skewed (i need to constrain the proportions, and crop if necessary).
- skt0
Just amend jerry's to include the code to keep the proportions.
- krust0
done, thanks guys...
Stage.scaleMode = "noScale";
Stage.align = "TL";
listener = new Object();
listener.onResize = function() {
mc_x._width = Stage.width;
mc_x._height = Stage.height;
if (mc_x._xscale>mc_x._yscale) {
mc_x._yscale = mc_x._xscale;
} else {
mc_x._xscale = mc_x._yscale;
}
};
listener.onResize();
Stage.addListener(listener);
stop();
_root.home.play();
var counter:Number = 0;