Calling embedSWF() with "flashvars"

This section provides a tutorial example on how to specify 'flshvars' parameters to the embedSWF() function provided by SWFObject 2.

Now let's use SWFObject 2 to play mp3player to learn how to specify flashvars in the embedSWF() function.

Here is the Web page with JavaScript codes to call embedSWF() to play mp3player with 2 flashvars parameters:

<html><head>
<!-- SWFObject_falshvars.html
 - Copyright (c) 2014, HerongYang.com, All Rights Reserved.
-->
</head><body>
<p>SWFObject flashvars 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">
var flashvars = {};
flashvars.mp3 = "Music_Sample.mp3";
flashvars.config = "mp3player_config.txt";
var params = {};
params.wmode ="transparent";
var attributes = {};
swfobject.embedSWF("player_mp3_maxi.swf", "myFlash", "200", "20",
   "8.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>

</body></html>

To test this Web page, you need to have 5 more files: expressInstall.swf, player_mp3_maxi.swf, Music_Sample.mp3, mp3player_config.txt and mp3player_skin.jpg.

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 mp3player displayed and you can play it. Otherwise, you will see a static image.

mp3player

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