Wednesday, March 18, 2009

Play flash below DHTML menu

This blog Post is sponsored by TeamHost.com
http://www.teamhost.com
TeamHost helps software developers create Web 2.0 software in a 10th the time.


In this post I will tackle the issue of trying to get flash to play underneath the DHTML/JavaScript dropdown menu.

We have just gone live with the Sharman & Campbell website, while working on this site I ran into a problem with the dropdown menu items displaying behind the flash animation. The solution to this is actually quite simple. Just change your wmode setting to out of a windowed mode. For those that want to rush off and fix the problem here the sample code.

Using AC_RunActiveContent.js

'wmode', 'window',

becomes

'wmode', 'opaque',

Using object tags

<param value="'window'" name="wmode">

becomes

<param value="opaque" name="wmode">


This solution works for both IE and Mozilla Firefox on my PC.

Why this works

According to adobe (http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000852.html) the wmode attribute/parameter has the following 3 values

Window plays the application in its own rectangular window on a web page. Window indicates that the Flash application has no interaction with HTML layers and is always the topmost item.

Opaque makes the application hide everything behind it on the page.

Transparent makes the background of the HTML page show through all the transparent portions of the application and can slow animation performance.

So basically when you use Window wmode the flash is playing in its own window above the HTML page, you can use either Opaque windowless and Transparent windowless to interact with HTML layers, letting layers above the SWF file block out the application. The difference between the two is that Transparent allows transparency so that HTML layers below the SWF file might show through if a section of the SWF file has transparency.

Performance Issues
A word of warning, using Wmode windowless can have negative impact on the performance of your flash, so don’t use it if you don’t need to.

Shameless Plug
Sharman & Campbell is a South African based importer, exporter and distributor of parts and accessories to the outdoor power equipment industry.

No comments:

Post a Comment