Hi to all
I have fluid background that loads picture. I want a picture on the
background with correct ratio.
On the main timeline I have clip: mcStage.mcBackground.pic
I load the picture (that is inside mc: mcStag.mcBackground.pic ) then
resize it in function resizeHolder(). That works fine only if browser
window is not scaled.
So I call: mcStage.mcBackground.pic.resizeHolder() after loading is complete.
MovieClip.prototype.resizeHolder=function(){
var sk:Number=Stage.width/Stage.height;
var pk:Number=this._width/this._height;
if (pk<sk) {
this._width = Stage.width;
this._height = Stage.width/pk ;
} else {
this._height = Stage.height;
this._width = Stage.height * pk ;
}
}
Fluid background scales in this function.
// 4: create function to position your MC at the top-left of the stage
function positionStageMC():Void {
this._x = (Movie.width/2)-(Stage.width/2);
this._y = (Movie.height/2)-(Stage.height/2);
this._width = Stage.width;
this._height = Stage.height;
this.mcBackground._width = Stage.width;
this.mcBackground._height = Stage.height;
}
positionStageMC();
var slistener:Object = new Object();
slistener.onResize = Delegate.create(this, positionStageMC);
Stage.addListener(slistener);
Can anybody point my mistake?
http://www.natavi.co.uk/test/fluid_bg.html
This is question 1.
I expected that if I call resizeHolder() in function
positionStageMC() that will help. But picture resizes not correctly.
It does not fit all background.
function positionStageMC():Void {
……..
this.mcBackground.pic.resizeHolder();
}
This is question 2. How resize window and have correct ratio for
picture that fill all background?
http://www.natavi.co.uk/test/wrong_ratio.html
Thank you in advance to all in this list.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders