Problem with Fullpage image

I am trying to get xml to load an image fullscreen and smoothed with BitmapData.

What works:
the code works, it loads and image and makes it full screen.

Whats broken:
it should load image fullscreen on startup, but doesn’t and should make it smoothed but doesn’t.


stop();
bg._alpha = 0;
maskx._width = 0;
maskx._height = 0;
bar._alpha = 100;
bar._width = 0;

stageListenerx = new Object();
stageListenerx.onResize = function() {
    var myMask = new mx.transitions.Tween(maskx, "_height", mx.transitions.easing.Strong.easeOut, maskx._height, _root.yheight, 1.200000E+000, true);
    myMask = new mx.transitions.Tween(maskx, "_width", mx.transitions.easing.Strong.easeOut, maskx._width, _root.xwidth, 1.200000E+000, true);
};
Stage.addListener(stageListenerx);
/////////////////////
// load background //
/////////////////////
bgpreload = 1;
var bgx = new XML();
bgx.ignoreWhite = true;
bgx.load("content/xml/backgrounds.xml");
bgx.onLoad = function(success) {
    dolzina = bgx.firstChild.childNodes.length;
    i = Math.floor(Math.random()*dolzina);
    bg.loadMovie(this.firstChild.childNodes*.childNodes[0].attributes.picx);
};
/*
transfer = function () {
    image = new flash.display.BitmapData(bg._width, bg._height);
    image.draw(bg);
    bg1.attachBitmap(image, 1, true, true);
    unloadMovie(bg);
};*/
p2.txtx.txtx.txtx.text = "LOADING RANDOM BACKGROUND";

/////////////////////
import flash.display.*;
function loadBitmapSmoothed(url:String, target:MovieClip) {
    var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth());
    var listener:Object = new Object();
    listener.tmc = target;
    listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void  {
        percent = Math.round((bytesLoaded/bytesTotal)*100);
        pText.text = percent+"%";
    };
    listener.onLoadInit = function(mc:MovieClip) {
        mc._visible = false;
        var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
        this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(), "auto", true);
        bitmap.draw(mc);
        // set size and position on load
        if (Stage.height/Stage.width>target._height/target._width) {
            img_prop = target._width/target._height;
            target._height = Stage.height;
            target._width = Stage.height*img_prop;
            target._y = (Stage.height/2)-(target._height/2);
            target._x = (Stage.width/2)-(target._width/2);
        } else {
            img_prop = target._height/target._width;
            target._width = Stage.width;
            target._height = Stage.width*img_prop;
            target._y = (Stage.height/2)-(target._height/2);
            target._x = (Stage.width/2)-(target._width/2);
        }
    };
    var loader:MovieClipLoader = new MovieClipLoader();
    loader.addListener(listener);
    loader.loadClip(url, bmc);
}
/////////////////////

// image source
loadBitmapSmoothed(this.picx, bg);

// set size and position on resize
var stage_listener:Object = new Object();
stage_listener.onResize = function():Void  {
    if (Stage.height/Stage.width>bg._height/bg._width) {
        img_prop = bg._width/bg._height;
        bg._height = Stage.height;
        bg._width = Stage.height*img_prop;
        bg._y = (Stage.height/2)-(bg._height/2);
        bg._x = (Stage.width/2)-(bg._width/2);
    } else {
        img_prop = bg._height/bg._width;
        bg._width = Stage.width;
        bg._height = Stage.width*img_prop;
        bg._y = (Stage.height/2)-(bg._height/2);
        bg._x = (Stage.width/2)-(bg._width/2);
    }
};
Stage.addListener(stage_listener);