Flash Tutorials - Herong's Tutorial Examples - v3.03, by Dr. Herong Yang
Playing Flash with Nested "object" Elements
This section provides a tutorial example on how to create nested 'object' elements to allow both Firefox and IE to play a Flash file correctly.
After going through those tests presented in previous sections, we now know that there are 2 primary ways to use the "object" element to play Flash files:
The question is then, how can we create an "object" element that works on both IE and Firefox?
The answer is using nested "object" elements as shown in the following example, object_object_swf.html:
<html><body> <!-- object_object_swf.html - Copyright (c) 2014, HerongYang.com, All Rights Reserved. --> <p>Flash with nested "object" 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 "object" is for Firefox and other browsers --> <object data="yahoo.swf" width="217" height="85"> <!-- The message is any browser failing on both --> Halloween on Yahoo! </object> </object> </td></tr> </table> </body></html>
This example code works perfectly on both Firefox and IE, because all browsers follow 2 rules when rendering "object" elements:
When IE opens the 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 "object" 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.
Table of Contents
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
Displaying Images as "object" Elements - Example
Displaying Images as "object" Elements on Firefox 26
Displaying Images as "object" Elements on IE 10
Playing Flash as "object[@data]" - Example
Playing Flash as "object[@data]" on Firefox 26
Playing Flash as "object[@data]" on IE 10
Playing Flash as "object[@classid]"
Playing Flash as "object[@classid]" - Example
Playing Flash as "object[@classid]" on Firefox 26
Playing Flash as "object[@classid]" on IE 10
►Playing Flash with Nested "object" Elements
Playing Flash with a Single "object" Element
Using "embed" Elements for Flash Files
"mp3player" - MP3 Music Player
SWFObject - Hidding "object" behind JavaScript
SWFTools - SWF File Manipulation Tools
SWFC Script to Generate Flash SWF Files
ActionScript Embedded in SWFC Script
AS3Compile - ActionScript 3 Compiler