Adding Flash in a Joomla Article and Flash Vars

Here is an example of adding Flash in Joomla. In this case one Flash movie reads 5 different picture lists in 5 different XML files. Which XML file to read is passed in a  “flash var” that is read by the Flash movie.

http://www.grimeyphoto.com/index.php/portraits

Here is how I did it.

  1. Download and install HTMLMod, so you can add custom php to you Joomla site. http://extensions.joomla.org/extensions/edition/custom-code-in-modules/5435
  2. I used dreamweaver to give me the initial Flash embed code.
  3. You will need to FTP the “Scripts” folder to the root directory of your Joomla install.
  4. Create the HTMLmod with the parts of code below that you need, and give it a position like “user6”. You may have to add the position manually.
  5. Load the module in the article by using {loadpostion user6} in the article where you want the Flash element to show up.

The code in the module:

<?php

$xml = “gallery_kids.xml”; // the name of the XML document
$movie = “photo_gallery.swf”;  // the flash file
$moviePath = “where ever you want to place the flash “;
$width = “550px”;
$height = “350px”;

?>
<p>
<object id=”FlashID” classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ width=”<?php echo $width; ?>” height=”<?php echo $height; ?>”>
<param name=”movie” value=”<?php echo $moviePath. $movie; ?>” />
<param name=”quality” value=”high” />
<param name=”wmode” value=”opaque” />
<param name=FlashVars value=”<?php echo ‘my_xmlList=’ . $xml; ?>” />
<param name=”swfversion” value=”8.0.35.0″ />
<!– This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. –>
<param name=”expressinstall” value=”Scripts/expressInstall.swf” />
<!– Next object tag is for non-IE browsers. So hide it from IE using IECC. –>
<!–[if !IE]>–>
<object type=”application/x-shockwave-flash” data=”$moviePath. $movie; ?>” width=”<?php echo $width; ?>” height=”<?php echo $height; ?>”>
<!–<![endif]–>
<param name=”quality” value=”high” />
<param name=”wmode” value=”opaque” />
<param name=FlashVars value=”<?php echo ‘my_xmlList=’ . $xml; ?>” />
<param name=”swfversion” value=”8.0.35.0″ />
<param name=”expressinstall” value=”Scripts/expressInstall.swf” />
<!– The browser displays the following alternative content for users with Flash Player 6.0 and older. –>
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href=”http://www.adobe.com/go/getflashplayer”><img src=”http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif” alt=”Get Adobe Flash player” width=”112″ height=”33″ /></a></p>
</div>
<!–[if !IE]>–>
</object>
<!–<![endif]–>
</object>
</p>
<script type=”text/javascript”>
<!–
swfobject.registerObject(“FlashID”);
//–>
</script>

0 Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>