PDA

View Full Version : full screen source rect, and onresize event question



smeared
December 19th, 2008, 05:43 PM
So, I have my fullscreen working, selecting a rectangle to scale to. and everything is good there,.. the issue is that the I have an onresize event, that positions the entire sprite... so.. when it goes into fullscreen, it obviously fires the resize event, which inconveniently slides my content to the right, as it tries to recenter the content... any way I can make it so it doesn't fire the resize event.. i suppose not..

thanks for any help

senocular
December 19th, 2008, 05:56 PM
Well, things do resize...

What you might want to do is in the resize event, check to see if you're in full screen. If so, don't resize.

smeared
December 19th, 2008, 11:35 PM
wow.. thanks man.. i wasn't thinking about that because it is in a different class.. but yeah.. duh.. thanks

dumAnAtor
January 7th, 2010, 04:52 AM
Here u r...
It so simple...
"bg" is our mc...

Stage.scaleMode = "noScale";
Stage.align = "LT";

stop();
///////////////////////////////////////////////BG SMOOTH RESIZING
var speed:Number = .2;
Stage.addListener(bg);
bg.onResize();
resizeWindow(bg,Stage.width+20, Stage.height+20)

bg.onResize = function() {
resizeWindow(bg,Stage.width+20, Stage.height+20)
};

function resizeWindow(target:MovieClip, newX:Number, newY:Number):Void
{
target.endX = newX;
target.endY = newY;
target.speed = speed;

target.onEnterFrame = function()
{
if(target.endX>=target.endY){
this._width += (target.endX-this._width)*this.speed
this._yscale = this._xscale

}else{
this._height += (target.endY-this._height)*this.speed
this._xscale = this._yscale
}
};
}
////////////////////////////////////////////////////////////////

:king::king::king::king::king: