[SWFObject] Toggling a flash file

Terry Cali swfobject-deconceptcom at dedicatedmanagers.com
Fri Sep 8 06:43:26 PDT 2006


I have a page on my site that loads various sounds into a flash file.  I use flv files, but you could just as easily embed the audio files in the swf, and just send the value to tell the flash movie which sound to play instead sending the actual source location of the file, like I do.  Its not asthetically pleasing yet, but the working page is here:
http://www.frankcaliendo.org/index.php?page=downloads&subpage=cellPhoneRingers

I'm not sure which version of Flash this requires, but I'm not using full communication, just controlling the flash file, which I think was available starting around release 6.x.  So the javascript sends a variable to the flash file and then tells it to play.  Inside the flash file, the code simply stops on the first frame when it first loads.  When its told to play via javascript, it plays the next frame, which plays the sound.  Then a line of script returns the playhead to the first frame and stops play, where it is ready for the new variable and to be told to play again (I can send this code, if I'm not clear).

Below is the javascript.

<script>

  function getFlashMovieObject(movieName){
    if (window.document[movieName]) 
    {
      return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet")==-1)
    {
      if (document.embeds && document.embeds[movieName])
        return document.embeds[movieName]; 
    }
    else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
      return document.getElementById(movieName);
    }
  }
  
  function changeFlashRinger(){
    var flashMovie=getFlashMovieObject("ringerPreviewPlayer");
   flashMovie.SetVariable("/:loadclip", document.ringerForm.ringerSelect[document.ringerForm.ringerSelect.selectedIndex].value);
   flashMovie.Play();
  }

</script>
<form name="ringerForm">  
  <select name="ringerSelect" onChange="changeFlashRinger()">
      <option value="http://www.frankcaliendo.net/multimedia/ringers/flv/AdamSandler1.flv">AdamSandler1</option>
      <option value="http://www.frankcaliendo.net/multimedia/ringers/flv/AdamSandler2.flv">AdamSandler2</option>
  </select>  
</form>


  ----- Original Message ----- 
  From: John Giotta 
  To: swfobject at lists.deconcept.com 
  Sent: Friday, September 08, 2006 8:08 AM
  Subject: Re: [SWFObject] Toggling a flash file


  So, constructing a controller/container SWF to load and mute the sound file SWF would be out of the question?



------------------------------------------------------------------------------


  _______________________________________________
  SWFObject mailing list
  SWFObject at lists.deconcept.com
  http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deconcept.com/pipermail/swfobject-deconcept.com/attachments/20060908/ad323591/attachment-0005.htm>


More information about the Swfobject mailing list