you can have the flash change the background color all by itself:
ActionScript Code:
AS3 code
...
import flash.external.*;
...
var JStodo:XML=
<script>
<![CDATA[
function (thiscolor) {
function changecolor(tothis)
{
window.document.getElementsByTagName('body')[0].style.backgroundColor=tothis;
};
changecolor(thiscolor);
}
]]>
</script>;
...
ExternalInterface.call(JStodo, '#FF0000');
...
Doing so you can keep the call to change the background color in the flash, that way,
in your case, you can set up a function in your flash that would change the background color whenever it loads a new page.
I don't know what your using to make your swf, so i can't really walk you threw the code, the above example would be for a pure AS3 solution.
now, why don't your different pages define a bgcolor for themselves in the HTML?
are you not talking about HTML pages?
Also to be clear, the above example uses JavaScript inside AS3, the example Wispa gave you, which will work as well, is JavaScript inside HTML, Java and JavaScript are two completely differnt things.