Methods for covering the flash layer by Div layer in different browsers

Source: Internet
Author: User
Code Problem:
By setting the Z-index of the DIV layer and flash layer, the DIV layer cannot overwrite the flash layer.
Official explanation:
A flash movie in a layer on a DHTML page containing several layers may display abve all the layers, regardless of the stacking order
("Z-index") of those layers.
Solution:
1. Modify flash attributes, applicable to Firefox and IE
In this solution, you need to modify the flash Code Make the flash transparent when loading, so the DIV layer can overwrite the flash.
Add in the original flash code
Add property wmode = 'transparent' in'
A. Original flash code

< Object Classid = 'Clsid: D27CDB6E-AE6D-11cf-96B8-444553540000'
Codebase = 'HTTP: // download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab?version=8, 0, 0'
Width = '400p' Height = '40px' >
< Param Name = 'Movie' Value = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' />
< Param Name = 'Quality' Value = 'High' />
< Embed SRC = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' Quality = 'High'
Pluginspage = 'HTTP: // www.macromedia.com/shockwave/download/index.cgi? P1_prod_version = shockwaveflash'
Type = 'Application/X-Shockwave-flash' Width = '000000' Height = '000000' >
</ Embed >
</ Object >

B. modified code

< Object Classid = 'Clsid: D27CDB6E-AE6D-11cf-96B8-444553540000'
Codebase = 'HTTP: // download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab?version=8, 0, 0'
Width = '400p' Height = '40px' >
< Param Name = 'Movie' Value = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' />
< Param Name = 'Wmode' Value = 'Transparent' >
< Param Name = 'Quality' Value = 'High' />
< Embed Wmode = 'Transparent' SRC = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' Quality = 'High'
Pluginspage = 'HTTP: // www.macromedia.com/shockwave/download/index.cgi? P1_prod_version = shockwaveflash'
Type = 'Application/X-Shockwave-flash' Width = '000000' Height = '000000' >
</ Embed >
</ Object >

2. Modify the position attribute [[br] [[br]
Set position: fixed for the DIV layer used to overwrite the flash. Because IE does not support fixed, this method only applies to Firefox.
A. Sample Code

< Html >
< Head >
< Title > Div cover flash with fixed property </ Title >
</ Head >
< Body >
< Div ID = "Cover_div" Style = "Position: fixed; width: 100px; Height: 100px; Background-color: Blue ;" > I cover the flash. </ Div >
< Object Classid = 'Clsid: D27CDB6E-AE6D-11cf-96B8-444553540000'
Codebase = 'HTTP: // download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab?version=8, 0, 0'
Width = '400p' Height = '40px' >
< Param Name = 'Movie' Value = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' />
< Param Name = 'Quality' Value = 'High' />
< Embed SRC = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' Quality = 'High'
Pluginspage = 'HTTP: // www.macromedia.com/shockwave/download/index.cgi? P1_prod_version = shockwaveflash'
Type = 'Application/X-Shockwave-flash' Width = '000000' Height = '000000' >
</ Embed >
</ Object >
</ Body >
</ Html >

3. Use IFRAME
IFRAME supports both Firefox and IE, but the implementation is slightly different.
The principle is to first cover flash with IFRAME, and then set the Z-index of IFRAME to enable Div to cover this IFRAME.
However, IFRAME in Firefox cannot cover flash by default. You need to set the AutoFlow attribute of the flash layer to auto. This problem does not occur in IE.
A. Sample Code in Firefox

< Html >
< Head >
< Title > Div cover flash with IFRAME </ Title >
</ Head >
< Body >
< Div ID = "Cover_div" Style = "Position: absolute; width: 100px; Height: 100px; Background-color: Blue; Z-index: 9" > I cover the flash. </ Div >
< Div Style = "Overflow: auto ;" >
< IFRAME ID = "Cover_iframe" Frameborder = "0" Style = "Position: absolute; width: 100px; Height: 100px; Z-index: 8 ;" > </ IFRAME >
< Object Classid = 'Clsid: D27CDB6E-AE6D-11cf-96B8-444553540000'
Codebase = 'HTTP: // download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab?version=8, 0, 0'
Width = '400p' Height = '40px' >
< Param Name = 'Movie' Value = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' />
< Param Name = 'Quality' Value = 'High' />
< Embed SRC = 'HTTP: // blog.ku6.com/ku6_v.swf? Id = 38752_1011788' Quality = 'High'
Pluginspage = 'HTTP: // www.macromedia.com/shockwave/download/index.cgi? P1_prod_version = shockwaveflash'
Type = 'Application/X-Shockwave-flash' Width = '000000' Height = '000000' >
</ Embed >
</ Object >
</ Div >
</ Body >
</ Html >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.