DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML和Xhtml >> 網頁中flash wmode屬性你會用嗎?
網頁中flash wmode屬性你會用嗎?
編輯:HTML和Xhtml     

在做web開發中可能會遇到flash遮擋頁面中元素的情況,無論怎麼設置flash容器和層的深度(z-index)也無濟於事,現有的解決方案是在插入flash的embed或object標簽中加入”wmode”屬性並設置為wmode=“transparent”或”opaque”,但wmode屬性到底是什麼意義,為什麼可以解
在flash標簽中
<param name=”wmode" value="xxxx">
"Window" 在 Web 頁上用影片自己的矩形窗口來播放應用程序,並且始終位於最頂層。
"Opaque" 顯示頁面上位於它後面的內容。
"Transparent"使 HTML 頁的背景可以透過應用程序的所有透明部分顯示出來,並且可能會降低動畫性能。
注:"Opaque"和"Transparent"都可與 HTML 層交互,從而允許 SWF 文件上方的層遮蔽應用程序。這兩種選項之間的差異在於"Transparent"允許透明,因此,如果 SWF 文件的某一部分是透明的,則 SWF 文件下方的 HTML 層可以透過該部分顯示出來,而"opaque"則不會顯示。
也就是如果發生FLASH遮蓋DIV層的情況,就必須要改wmode屬性為“Transparent”
在做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.
window 模式
默認情況下的顯示模式,在這種模式下flash player有自己的窗口句柄,這就意味著flash影片是存在於Windows中的一個顯示實例,並且是在浏覽器核心顯示窗口之上的,所以flash只是貌似顯示在浏覽器中,但這也是flash最快最有效率的渲染模式。由於他是獨立於浏覽器的HTML渲染表面,這就導致默認顯示方式下flash總是會遮住位置與他重合的所有DHTML層。
但是大多數蘋果電腦浏覽器會允許DHTML層顯示在flash之上,但當flash影片播放時會出現比較詭異的現象,比如DHTML層像被flash刮掉一塊一樣顯示異常。
Opaque 模式
這是一種無窗口模式,在這種情況下flash player沒有自己的窗口句柄,這就需要浏覽器需要告訴flash player在浏覽器的渲染表面繪制的時間和位置。這時flash影片就不會在高於浏覽器HTML渲染表面而是與其他元素一樣在同一個頁面上,因此你就可以使用z-index值來控制DHTML元素是遮蓋flash或者被遮蓋。
Transparent 模式
透明模式,在這種模式下flash player會將stage的背景色alpha值將為0並且只會繪制stage上真實可見的對象,同樣你也可以使用z-index來控制flash影片的深度值,但是與Opaque模式不同的是這樣做會降低flash影片的回放效果,而且在9.0.115之前的flash player版本設置wmode=”opaque”或”transparent”會導致全屏模式失效。
了解了各種模式的實現方式和意義在以後的開發中就可以按照具體情況選擇設置wmode屬性的值了。
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved