21 August 2008

Drupal Templating: Insert SWF to Drupal Theme

The easiest way to show Flash object/ SWF is inserting SWF code in a region block that we want to perform. For the simple animation, it can normaly run. But, if the embed SWF contains interaction with ActionScript function, it will definately cause the trouble such as flash interaction disabled in IE (follow this tutorial to fix "Click to Activate" issue on http://www.kirupa.com/developer/flash8/flash_fix.htm). To avoid this embed issue, I put SWF code directly to the Drupal theme on page.tpl.php file. This inserting code is full generated code with FlashObject method to easily display Flash animations without the hassle of having to have your users click first.

Here is my SWF code sample:

<script type="text/javascript" src="flashobject.js"></script>

<div id="flashcontent" style="width: 850px; height: 300px;"></div>

<script type="text/javascript">
var fo = new FlashObject
("/files/banner.swf", "animationName", "850", "300", "8", "#FFFFFF");
fo.addParam("allowScriptAccess", "sameDomain");
fo.addParam("quality", "high");
fo.addParam("scale", "noscale");
fo.addParam("loop", "false");

1 comment:

  1. Hеy there! This is my first visit to your blog! We are a team of volunteers and starting a nеw initiative in a community
    in the same niche. Yoour blog providеd uss valuable infoгmation to wotk
    on. You have done a eҳtraօrdinary job!

    My site :: scott tucker planet technologies