Playing Flash with Nested "object.embed" Elements

This section provides a tutorial example on how to create nested 'object.embed' elements to allow both Firefox and IE to play a Flash file correctly.

From the previous chapter, we learned that two "object" elements in different styles can be nested together to include a Flash file in a HTML document to make both IE and Firefox happy as shown below:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
   width="217" height="85">
<param name="movie" value="yahoo.swf">
   <object data="yahoo.swf" width="217" height="85">
      <img src="yahoo.gif" width="217" height="85"/>
   </object>
</object>

From this chapter, we learned that:

The question is now, can we nest an "embed" element inside an "object" element to make both IE and Firefox happy?

The answer is yes as shown in the example, object_embed_swf.html:

<html><body>
<!-- object_embed_swf.html
 - Copyright (c) 2014, HerongYang.com, All Rights Reserved.
-->

<p>Flash with nested "object.embed" elements:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tr><td>

<!-- The outer "object" is for IE and ActiveX based browsers -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
   width="217" height="85">
   <param name="movie" value="yahoo.swf"/>

   <!-- The inner "embed" is for Firefox and other browsers -->
   <embed src="yahoo.swf" width="217" height="85"/>

</object>
</td></tr>
</table>

</body></html>

The nested "object" and "embed" elements in this example code is actually the way recommended by Adobe to include Flash files in HTML documents.

When IE opens this example code, it will render the outer "object" element and ignore the element content which is the inner "object" element.

When Firefox opens the example code, it will fail on the outer "object" element first. It will then render the element content which is the inner "embed" element.

If you are reading the Web version of this book, you should be able to see the above Flash code played below. Otherwise, you will see a static image below.

Last update: 2014.

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

Using "embed" Elements for Flash Files

 What Is "embed" Element?

 Displaying Images as "embed" Elements - Example

 Displaying Images as "embed" Elements on Firefox 26

 Displaying Images as "embed" Elements on IE 10

 Playing Flash as "embed" Elements - Example

 Playing Flash as "embed" elements on Firefox 26

 Playing Flash as "embed" Elements on IE 10

Playing Flash with Nested "object.embed" Elements

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

 SWFC Script to Generate Flash SWF Files

 ActionScript Embedded in SWFC Script

 AS3Compile - ActionScript 3 Compiler

 Adobe Flex SDK 4

 SWF File Struture and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials

 References

 PDF Printing Version