I am relatively new to Drupal, and I am in the process of transferring a web site over to Drupal. I found that it was easier to try and create a new theme based off the HTML for the old site, and just add in the PHP code from an existing theme as required.
However I have encountered a problem with the flash animations in the header for the site. I have all the images required as well as the SWF files referenced in the HTML of the original site, but if I try to point the page.tpl.php template to any of the files, it either cannot find them or cannot display them for whatever reason. I encountered a similar problem when trying to embed an image in some test content for the site.
The code I have used in the page.tpl.php file is as follows (this code works perfectly in the original site):
<div id="header">
<div id="f_search">
<div id="pic-outer">
<div id="pic">
<embed type="application/x-shockwave-flash" src="images/pic.swf" id="pic" name="pic" quality="high" wmode="transparent" width="300" height="150">
</div>
<script type="text/javascript">
var so = new SWFObject("images/pic.swf", "pic", "300", "150", "7", "");
so.addParam("wmode", "transparent");
so.write("pic");
</script>
</div> <!-- /#pic-outer -->
<div id="title">
<h1 class="logo">
<div id="logo">
<embed type="application/x-shockwave-flash" src="images/logo.swf" id="logo" name="logo" quality="high" wmode="transparent" width="430" height="140">
</div>
<script type="text/javascript">
var so = new SWFObject("images/logo.swf", "logo", "430", "140", "7", "");
so.addParam("wmode", "transparent");
so.write("logo");
</script>
</h1>
</div> <!-- /#title -->
</div> <!-- /#f_search -->
</div> <!-- /#header -->
Originally, when i copied the source code for the original site directly (the paths pointed to the url for the actual site), the logo animation would play but the pic one did not. When I changed any of the paths to either a relative or absolute path, the whole thing ceased to work.
Any ideas as to what I may be doing wrong? I'm getting quite frustrated.
Comments
could I see the URL to your
could I see the URL to your site? make sure you have the js files loaded in the .info file (unless you have em referenced in the page, absolutely)
you could also try to reference the swf files like this
Site URL
The new site i am working with is currently not online (i am working on it on a wamp server). the current site that is not on drupal is at http://choicez.com.au/
That code you suggested was helpful, it got the logo animation to play. I can only assume that the pic one is missing some element of it required to work. Thanks for the help though.
Well i now have the logo
Well i now have the logo animation playing perfectly every time. However, i am still having troubles with the pic animation. So i thought i would describe how the files appear to me to work and see if anyone has an idea of how to get it to work.
In my theme folder (Choicez2) there are all the standard documents (.info file, page templates, stylesheet, etc.) Then there is the images folder (Choicez2/images) which contains all the pictures required plus all the swf files i need. the pic.swf file contains action scripting that randomly calls one of five swf files (pic_x.swf) which are all in the same directory. the action script in the pic.swf file is as follows:
If i open pic.swf in an swf player, it works perfectly how i want it to, but when i call it in the page.tpl.php document, it does not display on the website. The code i am now using to do this is:
Again, this code works for the logo.swf file, but not for this one. Can someone help?
check loadMovie
Seems that in your loadMovie, the it is not loading relevant to the Drupal folder, this is why you are seeing it when you run the .swf file, but not in page.tpl.php
you can try this in your pic.fla file:
by doing that, the .fla will load using an absolute path. Should work. let me know if it does.
Cleaner code
Not directly related to your quandary about the "pic" flash object not playing... but some pertinent details about your use of the SWFObject Flash script.
When you use
so.write()to place the Flash content into a container (i.e. div #logo), there is no need to also include the EMBED tag within that container. Unless you do so to address a no-scripts scenario for the user's browser, in which case of course you need to wrap the EMBED within NOSCRIPT tag.(You might however consider placing some alternate content in that target div - for example text that describes what the Flash object says or does, for the benefit of S.E. text crawlers. Can help in S.E. ranking. Also, possibly a message advising if the reader sees this text, they're lacking Flash plug-in "and here's where to get it". Any browser that has Flash plug-in will of course see neither, as intended with alternate content.)
Also note that you are using id "logo" and "pic" twice - for the div ID, and also for the EMBED object ID. They need to be unique.