Embed a flash movie in Wordpress post
I am trying to get this flash carousel to show up in a Wordpress post. I can right click on the blank space where it should be and bring up the flash options menu, but no movie is showing. It links to an xml document that pulls in the images and text. Is it an xml issue? Below is what I placed in my wordpress template header to allow the flash movie to run:
<script src="<?php bloginfo('template_directory'); ?>/scripts/swfobject.js" type="text/javascript"></script>
<!-- JavaScript function - called by the animation -->
<script type="text/javascript">
function MyFunction(p1){
alert("You have clicked on: " + p1);
}
</script>
Everything is where it should be including the reference to the swfobject being in the themes "scripts" folder. Now here is the code I put in the post I am working on:
<!-- BEGIN embed 3D Carousel -->
<!-- This <div> is replaced by the Flash content! (see "SWFObject embed by Geoff Stearns ..." below)
Place your alternate content here and users without the Flash plugin
or with Javascript turned off will see this.-->
<div id="flashcontent">
<br />
<br />
<cent开发者_如何学运维er>
<a target="_blank" href="http://www.macromedia.com/go/getflash/">
<img border="0" alt="" src="images/getflash.png" />
</a>
</center>
</div>
<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->
<script type="text/javascript">
var so = new SWFObject("3dcarouseldev.swf", "3dcarouseldev", "780", "460", "8.0.0.0", "#ffffff");
so.addParam("quality", "high");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.addParam("salign", "lt");
so.addParam("wmode", "transparent");
so.addParam("flashvars", "configfile=3dcarousel.xml");
so.write("flashcontent");
</script>
<!-- END embed 3D Carousel -->
Any reason this won't work even though I am linked correctly to all support files? Does Wordpress not like embedding Flash? The hosting is on Godaddy if that helps any.
Thanks!
WordPress.org blocks SCRIPT
/EMBED
/OBJECT
tags by default.
You can disable this with some hackery, or there are a few plugins that provide a custom syntax like [youtube][/youtube]
, but the better solution may be to upgrade to WordPress 2.9, which has oEmbed support.
I think that the link to your actual flash movie is not linked correctly. Remember that when you reference a file name, you need to use the correct path to your theme directory. You've done this to load your swfobject.js file, but not for 3dcarouseldev.swf.
Change the following line in your script:
var so = new SWFObject("3dcarouseldev.swf", "3dcarouseldev", "780", "460", "8.0.0.0", "#ffffff");
to this:
var so = new SWFObject("<?php bloginfo('template_directory'); ?>/3dcarouseldev.swf", "3dcarouseldev", "780", "460", "8.0.0.0", "#ffffff");
This will give the complete path to your theme directory to your javascript variable. This assumes that your 3dcarouseldev.swf file is in your theme folder (and not a sub directory). If the file is somewhere else, you'll have to adjust the directory to point to the right place.
精彩评论