How to give Play / Pause in a SWF contained in HTML?

4

My HTML looks like this:

  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  width="550" height="440" id="movie" align="">
  <param name="movie" value="swf-file.swf">
  <param name="quality" value="High">
  <param name="bgcolor" value="FFFFFF">
  <param name="_cx" value="5794">
  <param name="_cy" value="4524">
  <param name="FlashVars" value="-1">
  <param name="Src" value="swf-file.swf">
  <param name="WMode" value="Window">
  <param name="Play" value="-1">
  <param name="Loop" value="0">
  <param name="SAlign" value="">
  <param name="Menu" value="-1">
  <param name="Base" value="">
  <param name="AllowScriptAccess" value="always">
  <param name="Scale" value="ShowAll">
  <param name="DeviceFont" value="0">
  <param name="EmbedMovie" value="0">
  <param name="SWRemote" value="">
  <embed src="swf-file.swf" quality="high" bgcolor="#FFFFFF" width="550" height="440" name="movie" align="" type="application/x-shockwave-flash"  >
   </object>

I just need a script that will run a Play / Pause button. I searched in various places, but found none to answer. From what I realized With this SWF format this is a bit difficult.

    
asked by anonymous 09.05.2014 / 00:21

1 answer

2

To make this control you can make a JavaScript and ActionScript interaction. This site shows how to make an interaction via JS commands.

Below I've made a slightly more simplified example and it worked perfectly, but I ask you to check the compatibility in different browsers:

HTML Flash object:

<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="219" height="171" id="movie">
    <param name="movie" value="teste.swf">
    <param name="quality" value="High">
    <embed src="teste.swf" width="246" height="187" name="movie" type="application/x-shockwave-flash">
</object>

Command buttons:

<a href="javascript:document.movie.Play()">PLAY</a>
<br/>
<a href="javascript:document.movie.StopPlay()">STOP</a>

If you want to go beyond or have a compatibility problem, check the command called ExternalInterface , responsible for the communication between Flash and Javascript. With it you can pass Javascript commands to ActionScript and vice versa.

    
09.05.2014 / 15:25