> > Tutorials > T1026

Z-Index and Flash.

Control stacking order of Flash and DHTML elements with z-index. Use z-index negative value to put objects behind and positive value to bring items to front.

To make items visible below Flash animation you have to export SWF file in windowless mode (WMODE=transparent).

The following example demonstrates 3 objects, Flash animation with z-index:0, “Text BELOW” (z-index:-1) and “Text ABOVE” (z-index:1)


  1. Launch Flash Designer and choose “Blank Animation”. Choose “Frame” > “Frame Size” to set movie dimensions. Enter 300 x 240 and click OK.
  2. Choose “Rectangle” tool and draw a rectangle inside the frame.
  3. Choose “Edit” > “Align” > “Center on Page”
  4. Choose “Item” > “Sprite Animation” and select “Rotate 360” and “Medium” speed, click OK.
  5. Choose “Text” tool, click inside the rectangle and type the text in the “Text Edit” dialog: “Flash Item”. Click OK.
  6. Choose “Edit” > “Align” > “Center on Page”
  7. Choose “Intro” > “Intro Animation”. Check “Enable”, select “Stretch”, “Vertical”.
    Click “Text Animation” and check “Enable Glyph Animation” and click OK. Check “2 way” and “Always Visible” and click OK.
  • Press F9 to preview the fileExport Flash SWF File
    1. Choose “Movie” > “Export Options”, check “Transparent” and click OK.
    2. Choose “File” > “Export Flash SWF File”, navigate to Desktop, leave “Untitled-1” as the name and click OK
    3. Choose “File” > “Export Web Page”, select a name and click OK. The web page should popup in a browser window.
    4. Right click in the browser window and choose “View Source” to edit the HTML file.
    5. Replace entire HTML code with the code below. Save the file and refresh the browser.

    <DIV STYLE="z-index: 1; position:relative; left:100px; top:165px;"><b><font color=blue>Text ABOVE the Flash</b></font></DIV>

    <DIV STYLE=”z-index: 0; position:relative”>
    <DIV STYLE=”z-index: -1; position:relative; left:50px; top:95px;”><b><font color=red>Text BELOW the Flash</b></font></DIV>
    <OBJECT CLASSID=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″
    WIDTH=”300″ HEIGHT=”240″
    <PARAM NAME=”MOVIE” VALUE=”Untitled-1.swf”>
    <PARAM NAME=”PLAY” VALUE=”true”>
    <PARAM NAME=”LOOP” VALUE=”true”>
    <PARAM NAME=”WMODE” VALUE=”transparent”>

    get flash