# Replace Document Background?!

**URL:** <https://forum.kirupa.com/t/replace-document-background/163269>\
**Category:** flash\
**Created:** [September 21, 2005, 6:15am UTC](https://forum.kirupa.com/t/replace-document-background/163269 "2005-09-21T06:15:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MAKEitLOUD](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@MAKEitLOUD](https://forum.kirupa.com/u/MAKEitLOUD)\
**Post date:** [September 21, 2005, 6:15am UTC](https://forum.kirupa.com/t/replace-document-background/163269/1 "2005-09-21T06:15:01Z")

</div>

I saw this on the [G4TV](http://www.g4tv.com/) web site.

They have a flash animation that scrolls through news titles, and when it gets to the next news title, the flash file calls a script and it changes the background on the document.

I have searched all through the internet and only came up with the “[color=blue]on[/color] ([color=blue]click[/color]){” function to call the script, i replaced it with “[color=blue]on[/color] ([color=blue]load[/color]){” but Flash doesn’t understand it. :tired:

So i was wondering if any-one knew the action script for the flash file, i don’t need the JavaScript because, well, it’s right here:

```auto

// called by Flash to change page background
function changeBackgroundImg(newBgImg){
var d = document;
var oBackgroundImg = d.getElementById("bg-custom");
if (d.getElementById)
{
oBackgroundImg.src = newBgImg;
}
}

```

_It was located in an external Javascript document._

… But i want this to change the background when the document first loads. The file is only a few _kb_ so it would change almost instantly on call so the image probably doesn’t need to be ‘pre-loaded’ along with the rest of the animation.

To understand this a lot clearer, check out the G4TV web site, and then you might be able to get what i mean… =)

I really need help with this… Please… :cowbell:  
MAKEitLOUD
