import flash.external.*;
var jsCall:String;
btn.onPress = function() {
jsCall = String(ExternalInterface.call("changeBgColor", "#fffecb));
};
Add the following Javascript to your HTML code:
<script language="JavaScript">
function changeBgColor(newBgColor)
{
if (window.document && window.document.bgColor)
{
document.bgColor = newBgColor;
}
}
</script>
You can add a little random spice by using the following Actionscript:
import flash.external.*;
var jsCall:String;
btn.onPress = function() {
ranColor = Math.round(Math.random() * 0xFFFFFF);
jsCall = String(ExternalInterface.call("changeBgColor", ranColor));
};
You can see a working example here along with the code.
Follow this link for details on how to change the background image.
No comments:
Post a Comment