L'immagine di fondo l'ho fatta grande 800*600 (ma la si puo fare anche piu piccola) e si ridimensiona senza strecciarsi.
Questo il code:
Frame 1 Preload
codice:
Stage.align = "TL";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
this.onEnterFrame = function()
{
this.preload._x = Math.floor(Stage.width / 2 - this.preload._width / 2);
this.preload._y = Math.floor(Stage.height / 2 - this.preload._height / 2);
byl = this.getBytesLoaded();
byt = this.getBytesTotal();
if( byt > 10 )
{
perc = Math.round(byl * 100 / byt);
this.preload.percentuale.text = "load background" + " " + perc + "%";
if(byl >= byt)
{
this.onEnterFrame = undefined;
this.nextFrame();
}
}
}
stop();
sul primo frame metti una casella di testo dinamico istanziata percentuale e inserisci la stessa dentro un mc istanziato a sual volta preload
Frame2
codice:
_root.bkg.w = _root.bkg._width;
_root.bkg.h = _root.bkg._height;
myResize = new Object();
function Window()
{
var CDim = _root.bkg.w / _root.bkg.h;
var SDim = Stage.width / Stage.height;
if (SDim < CDim)
{
_root.bkg._height = Stage.height;
_root.bkg._width = _root.bkg.w * Stage.height / _root.bkg.h;
} else {
_root.bkg._width = Stage.width;
_root.bkg._height = _root.bkg.h * Stage.width / _root.bkg.w;
}
_root.bkg._quality = "BEST";
};
myResize.onResize = function()
{
Window();
}
Stage.addListener(myResize);
Window();
movieclip che contiene l'immagine e che devi posizionare a coordinate 0 0 sullo stage lo devi istanziare "bkg"