How to change swf file onclick of button

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasper89
Forum Newbie
Posts: 1
Joined: Mon May 17, 2010 5:33 pm

How to change swf file onclick of button

Post 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
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: How to change swf file onclick of button

Post 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>
Post Reply