Hey Guys,
I love this forum.
I’ve found a lot of helpful tips here, but this time I’m having a bit of a problem.
I’m using this code to load a different, fullscreen background in to my site every time it loads:
stop();
import mx.transitions.Tween;
import mx.transitions.easing.*;
//StageAlign
Stage.scaleMode = "noScale";
Stage.align = "LT";
bg._alpha = 0;
_root.mc_preloader.bar._visible = false;
_root.mc_preloader.pText._visible = false;
//AspectRatio & Fullscreen achtergrond
Stage.addListener(bg);
bg.onResize = function() {
var imageAspectRatio = this.bgLoad._width/this.bgLoad._height;
var stageAspectRatio = Stage.width/Stage.height;
if (stageAspectRatio>=imageAspectRatio) {
this._width = Stage.width;
this._height = Stage.width/imageAspectRatio;
} else {
this._height = Stage.height;
this._width = Stage.height*imageAspectRatio;
}
this._x = -(this._width-Stage.width)/2;
this._y = -(this._height-Stage.height)/2;
};
//MclListener
var mclListener:Object = new Object();
mclListener.onLoadProgress = function(mc, w, t) {
_root.mc_preloader.bar._visible = true;
_root.mc_preloader.pText._visible = true;
_root.mc_preloader.bar._width = (w/t)*100;
_root.mc_preloader.pText = Math.round((w/t)*100)+"%";
var w = image_mc.getBytesLoaded();
var t = image_mc.getBytesTotal();
};
mclListener.onLoadInit = function(mc:MovieClip) {
_root.bg.onResize();
};
mclListener.onLoadComplete = function(mc:MovieClip) {
var bgAlpha:Tween = new Tween(bg, "_alpha", Strong.easeOut, 0, 100, 1, true);
var prcAlpha:Tween = new Tween(mc_preloader, "_alpha", Strong.easeOut, 100, 0, 2, true);
bgAlpha.onMotionFinished = function() {
_root.gotoAndPlay(2);
};
};
var image_mc1:MovieClipLoader = new MovieClipLoader();
image_mc1.addListener(mclListener);
// Achtergrond laden via xml
var bg_xml = new XML();
bg_xml.ignoreWhite = true;
bg_xml.load("backgrounds.xml");
bg_xml.onLoad = function(success) {
counter = bg_xml.firstChild.childNodes.length;
i = Math.floor(Math.random()*counter);
image_mc1.loadClip(this.firstChild.childNodes*.childNodes[0].attributes.url, bg.bgLoad);
};
But when the screen resizes, the image becomes unsmooth.
I’d like to get my backgrounds smoothed, but I don"t know how to do this with as. I’ve tried out loadBitmapSmoothed() , but I can’t get this to work.
Anyone who can help me with this? I’d be forever grateful.
Thanks,
Bartvdb