在做web开发中可能会遇到flash遮挡页面中元素的情况,无论怎么设置flash 容器和层的深度(z-index)也无济于事,现有的解决方案是在插入flash的embed或object标签中加入”wmode”属性并设置为 wmode=“transparent”或”opaque”,但wmode属性到底是什么意义,为什么可以解决这个问题呢?
window mode(wmode)
wmode即窗口模式总共有三种,看看当年Macromedia官方的说法:
- Window: Use the Window value to play a Flash Player movie in its own rectangular window on a web page. This is the default value for wmode and it works the way the classic Flash Player works. This normally provides the fastest animation performance.
- Opaque: By using the Opaque value you can use JavaScript to move or resize movies that don’t need a transparent background. Opaque mode makes the movie hide everything behind it on the page. Additionally, opaque mode moves elements behind Flash movies (for example, with dynamic HTML) to prevent them from showing through.
- Transparent: Transparent mode allows the background of the HTML page, or the DHTML layer underneath the Flash movie or layer, to show through all the transparent portions of the movie. This allows you to overlap the movie with other elements of the HTML page. Animation performance might be slower when you use this value.