Skip to main content
Participant
October 15, 2007
Question

action script to change background colour of html page

  • October 15, 2007
  • 2 replies
  • 272 views
Hi, I'm trying to create a button in my flash move that would be able to change the background colour of the html page that holds it. I have posted this question on another site and someone gave me this code to use:

<html>....<head>
<SCRIPT LANGUAGE=JavaScript>
<!--
function NEWbg(newcolor) {
document.bgColor=newcolor;
}
//-->
</SCRIPT>

Button action in flash :
on(release){
getURL("javascript:NEWbg('#FFFFFF')");
}

/////////////////////////////

or from flash w/o any code in html :

on(release){
getURL("javascript:document.bgColor='#FFFFFF'; void(0);");
}

The problem with this is that it brings up a dialogue box about flash security settings when you press the button which obviously won't do. does anyone know another method? I'm using action script 1. Thanks in advance.
This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
October 15, 2007
it happens when you test locally. there won't be a security issue if your html and swf are on a server.
kglad
Community Expert
Community Expert
October 15, 2007
no other way with as1.
Participant
October 15, 2007
ok thanks. what is the security problem? does that normally happen when using this method?