Page 1 of 1

How to change swf file onclick of button

Posted: Mon May 17, 2010 5:38 pm
by jasper89
i have 2 swf files(Scene2.swf and scene3.swf , how do i do it such that clicking Button onclick= " " will cause it to run movie.value = "Version1/Scene2.swf
My default swf file declared.

<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="470" height="450">
<param name="movie" value="Version1/Scene3.swf" />

<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.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" />


Thanks !! Sorry but im very new to this and may sound stupid. Thanks

Re: How to change swf file onclick of button

Posted: Mon May 17, 2010 6:52 pm
by Bind
You can do this 2 different ways.

1. With PHP by setting and parsing the GET query_string. This will force a new page reload updating the new values when the visitor clicks the link.

Code: Select all

<?php
if(isset($_GET['id']) && !empty($_GET['id']))
   {
      $movieid=$_GET['id']; # movieid pulled from the query_string
   }
else
   {
      $movieid='2'; # default movieid
   }
?>
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="470" height="450">
<param name="movie" value="Version1/Scene<?php echo $movieid; ?>.swf" />

<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.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" />
</object>
<p>
   <a href="./?id=3">Click here to see Scene 3</a>
</p>
2. With some javascript to automatically update the object param with the new value without a page reload when the visitor clicks the button. Button can also be replaced with a link.
PHP

Code: Select all

<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="470" height="450">
<param name="movie" value="Version1/Scene2.swf" />

<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.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" />
</object>
<p>
   <form>
      <input type="submit" name="submit" value="Scene 3" onclick="document.FlashID.movie.value='Version1/Scene3.swf'" />
   </form>
</p>