3.How to center the Flash menu even the web page is resized?
Please notice the position of the menu blow, when you resize the web browser
Please follow these steps to achieve it.
1) Please add reference of 'flashobject.js' in the page between <head> and </head>.
<script type="text/javascript" src="flashobject.js"></script>
Note: The javascript will be afforded by the application
2) Please add the
ID attribute for the Flash object.
<DIV ID="objMenu">123 Flash Menu Place Holder</DIV>
<script type="text/javascript">
var fo = new FlashObject("gsl.fmp.swf", "myMenu", "740", "196", "6", "#FFFFFF");
fo.addParam("menu","false");
fo.addParam("quality","best");
fo.addParam("salign","LT");
fo.addParam("scale","noscale");
fo.addParam("wmode", "transparent");
fo.write("objMenu"); //same name with the ID of DIV
if (navigator.appName.indexOf("Microsoft")!= -1) {
// MSIE4+, please add style attributes of flash here
document.myMenu.style.position="absolute";
document.myMenu.style.zIndex="20";
document.myMenu.style.top="75px";
}else{
// NN4+&Others, please add style attributes of flash here
document.getElementById('myMenu').style.position="absolute";
document.getElementById('myMenu').style.zIndex="20";
document.getElementById('myMenu').style.top="75px";
}
</script>
3) Add
AdjustMenu() javascript function into the web page.
<SCRIPT LANGUAGE="JavaScript">
function AdjustMenu() {
var w_newWidth;
if (navigator.appName.indexOf("Microsoft") != -1) {
// MSIE4+
w_newWidth=document.body.clientWidth;
document.myMenu.style.left=(w_newWidth-document.myMenu.width)/2+'px';
} else {
// NN4+&Others
w_newWidth=window.innerWidth;
document.getElementById('myMenu').style.left=(w_newWidth-document.getElementById('myMenu').width)/2+'px';
}
}
</SCRIPT>
Note: The
myMenu is the ID of Flash object, please use the same name in the script.
4) Add 'onload="AdjustMenu()" onresize="AdjustMenu()"' to BODY tag. When the
browser is resized, the adjust position function will be called.
5) For more detail informtion about Flashobject please refer to flashobject.js
usage.