14. How to use 'flashobject.js' to display the Flash menu in the HTML?
After Internet Explorer was updated to version 6+, when mouse move on the Flash in the page there will
be a 'click to active' tip information pops up. This feature is more confused to visitors when they
browse page with Flash menu. The Javascript detects Flash player versions in the browsers from version 3
and up, and will allow users to interactive with your Flash content
without 'activating' it first. This Javascript can be used to all
flash object in the HTML. The Javascript works in all the current web
browsers, including, on PC: IE5/5.5/6, Netscape 7/8, Firefox, Mozilla, and Opera.
1) Please add reference of 'flashobject.js' in the page between <head> and </head>.
<script type="text/javascript" src="flashobject.js"></script>
Note: The above javascript codes will be generated by the application.
2) Add follow script to replace original Flash object code. The Flash will be explained by the script
and displayed in the <DIV> tag.
<DIV ID="menu">123 Flash Menu Place Holder</DIV>
<script type="text/javascript">
var fo = new FlashObject("navmenu.swf", "myMenu", "142", "250", "6", "#FFFFFF");
fo.addParam("menu","false");
fo.addParam("quality","best");
fo.addParam("salign","LT");
fo.addParam("scale","noscale");
fo.addParam("wmode", "transparent");
fo.write("menu");
</script>
3) Create a new SWFObject and pass in the required parameters like follow:
- swf - The file path and name to your swf file.
- id - The ID of your object or embed tag.
- width - The width of your Flash movie.
- height - The height of your Flash movie.
- version - The required player version for your Flash content. This can be a string in
the format of 'majorVersion.minorVersion.revision'. An example would be: "6.0.65".
Or you can just require the major version, such as "6".
- background color - This is the hex value of the background color of your Flash movie.
4) If you want to use some of the other parameters the Flash plug-in has to offer then please
use
addParam function add any extra parameter you may need.
... ... ...
fo.addParam("menu","false");
fo.addParam("quality","best");
fo.addParam("salign","LT");
fo.addParam("scale","noscale");
fo.addParam("wmode", "transparent");
... ... ...
5) How to use flashobject.js to implement 'layer' effect?
You can define the style attributes to locate the position of the Flash menu in the page like follow:
<DIV ID="menu">123 Flash Menu Place Holder</DIV>
<script type="text/javascript">
var fo = new FlashObject("navmenu.swf", "myMenu", "142", "250", "6", "#FFFFFF");
fo.addParam("menu","false");
fo.addParam("quality","best");
fo.addParam("salign","LT");
fo.addParam("scale","noscale");
fo.addParam("wmode", "transparent");
fo.write("menu");
if (navigator.appName.indexOf("Microsoft")!= -1) {
// MSIE4+
document.myMenu.style.position="absolute";
document.myMenu.style.zIndex="20";
document.myMenu.style.top="200px";
document.myMenu.style.left="100px";
}else{
// NN4+&Others
document.getElementById('myMenu').style.position="absolute";
document.getElementById('myMenu').style.zIndex="20";
document.getElementById('myMenu').style.top="200px";
document.getElementById('myMenu').style.left="100px";
}
</script>
Note: the script has been different browser gives different method.
6) How to implement Layered & Floating effect with 'flashobject.js'?
Please add reference of 'flashfloat.js' in the page between <head> and </head> too.
The script in the HTML just like code in the 5). Please refer to
float effect demo
7) How to implement center Flash menu with 'flashobject.js' even the web page is resized?
Please refer to
online support and demo
For detail information about the FlashObject please refer to "
Javascript Flash detection and embed script"