Calling swfobject.embedSWF() Function

This section provides a tutorial example on how to embed SWF files in Web pages using the embedSWF() function provided by SWFObject 2.

After reading the SWFObject 2 documentation at http://code.google.com/p/swfobject/wiki/documentation, I wrote a simple tutorial example to play the Yahoo Flash, SWFObject_test:

<html><head>
<!-- SWFObject_test.html
 - Copyright (c) 2014, HerongYang.com, All Rights Reserved.
-->
</head><body>
<p>SWFObject Test:</p>

<!-- Define a place to play the Flash -->
<div id="myFlash">
  This text will be replaced later by SWFObject.
</div>

<!-- Include SWFObject JavaScript library -->
<script type="text/javascript" src="swfobject.js"></script>

<!-- Define a place to play the Flash -->
<script type="text/javascript">
swfobject.embedSWF("yahoo.swf", "myFlash", "217", "85", "8.0.0");
</script>

</body></html>

Then I copied WFObject_test.html together with swfobject.js to a new folder, and opened it with Firefox and IE. The Yahoo flash worked nicely!

I have included the above code here on this page. If you are reading the Web version of this book, you should be able to see Yahoo displayed as animation. Otherwise, you will see a static image.

Yahoo!

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

 "mp3player" - MP3 Music Player

SWFObject - Hidding "object" behind JavaScript

 What Is SWFObject?

Calling swfobject.embedSWF() Function

 embedSWF() Function and Arguments

 Calling embedSWF() with "flashvars"

 What is SWFObject HTML Code Generator?

 Generating SWFObject HTML Code

 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 Structure and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials

 References

 PDF Printing Version