Inserting flash videos into web pages or window forms to create dynamic effects is a common way to display dynamic effects. However, if the web page or form has a layered structure, how can we make the background of the flash transparent?
Today, CG will solve a small problem regarding the transparent display of flash videos in a container during playback. I believe everyone has encountered this issue when creating web pages or winforms. You don't need to deliberately modify the background of the flash video to be transparent because setting it to transparent will have the same effect in the flash control. Here, I will share a method to set the Wmode property of the flash container (control).
Below are the three different parameters for Wmode:
- Window: This is the default mode and is also the fastest rendering mode according to the Adobe official documentation. However, this mode uses an independent display mode separate from the container, similar to the window form mode we are familiar with. In this mode, the flash video is essentially a flash playback window that can be independently controlled. The default background is opaque, which is why the container appears separate when displayed. This window is managed by the operating system.
- Opaque: This is a mode without a window, corresponding to the window mode. It is usually managed by the DOM it belongs to. In web development, it can be used as a DIV layer and is quite flexible. However, this mode uses absolute positioning and is usually controlled by nesting to ensure correct display position. It is commonly used in web development.
- Transparent: This is the mode that solves the problem. It is a special display mode with a transparent background that ignores the original background setting of the flash animation. It is used in multi-layer display effects. However, this mode is officially stated to be the slowest rendering mode and is a special form of the Opaque mode. It also requires a higher version of Flash. Please be aware of this when using it.
Usage:
WinForm: Simply set the Wmode property of the AXShockWaveFile control to the corresponding mode string. If you are using VC++, it is recommended to use the setWmode method of the control. This method is supported by all programming languages.
Web: If you are using the object display method, you can add a parameter in the display parameters. The parameter is as follows:
If you are using the embed method, you can consider adding the wmode parameter in the calling parameters.Here are the code examples for both methods.