# Background onResize xml problem

**URL:** <https://forum.kirupa.com/t/background-onresize-xml-problem/285066>\
**Category:** flash\
**Created:** [March 26, 2009, 5:31pm UTC](https://forum.kirupa.com/t/background-onresize-xml-problem/285066 "2009-03-26T17:31:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marvinnr1](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@marvinnr1](https://forum.kirupa.com/u/marvinnr1)\
**Post date:** [March 26, 2009, 5:31pm UTC](https://forum.kirupa.com/t/background-onresize-xml-problem/285066/1 "2009-03-26T17:31:49Z")

</div>

Hi,

I’m currently working on a site where the background pictures (wallpapers) loads randomly with xlm.  
Loading of the pictures working properly until I try to put the AS: (stageResize/stageListener) it doesn’t load.  
I have tried numerous things but it’s still not working.

I’ve used the following script:

```auto
Stage.scaleMode = "noScale";
Stage.align = "TL";
stageResize = function () {
background_mc._x = 0;
background_mc._y = 0;
background_mc._width = Stage.width;
background_mc._height = Stage.height;
maskbg_mc._y = Stage.height / 2 - maskbg_mc._height / 2;
maskbg_mc._x = Stage.width / 2 - maskbg_mc._width / 2;
};
 
stageResize();
var stageListener:Object = new Object();
stageListener.onResize = function() {
    stageResize();
};
Stage.addListener(stageListener);

```

```auto
var bgxml = new XML();
bgxml.ignoreWhite = true;
bgxml.load("xml/backgrounds.xml");
bgxml.onLoad = function (success)
{
    back = bgxml.firstChild.childNodes.length;
    i = Math.floor(Math.random() * back);
    background_mc.loadMovie(this.firstChild.childNodes*.childNodes[0].attributes.pica);
};

```

Does anybody have a clue how I can solve this problem?  
I also include the [FLA](http://www.megaupload.com/?d=YRTQ96MC).

Thanks,

Marvin
