Search code examples
flashswfobject

SWFObject addParam failure


So I'm simply trying to prevent a flash video from playing on page load but have so far been unsuccessful. The code in question is as follows:

<div id="flashcontent">This text is replaced by the Flash movie.</div>
<script type="text/javascript">

var so = new SWFObject("link_to_video","mymovie", "350", "400", "8", "");

so.addParam("play","false");          
so.write("flashcontent");

</script>

with link_to_video of course actually being a real link. The video plays just fine, but with or without that addParam it plays on page load. The code is using a local version of SWFObject that's at version 1.5, but as far as I can tell the addParam function is available in 1.5. Upgrading to 2.0 is not a desirable solution.


Solution

  • Is your video an actual Flash movie with animations on the main timeline? That's the only thing that the play parameter will actually control. If your SWF is a video player of some sort then the play parameter won't actually do anything. Instead, you'll probably use addVariable and then look for that variable inside of your SWF (in AS3 it's in the Stage's loaderInfo object) and use that value to determine if the video auto-plays or not.