0 Replies Latest reply on May 10, 2007 5:35 AM by ToonMariner

    Load sound

      Hi everyone.

      Having a spot of bother with loading a sound and js integration...

      I have a flash file with two frames (nothing on them but an image that does notihng - moved image in frame 2 so I can see that something has happened).

      Action script in frame 1:


      Action script in frame 2:

      var my_sound:Sound = new Sound();
      my_sound.onLoad = function(success:Boolean) {
      if (success == true)

      my_sound.loadSound(audio, false);
      my_sound.onSoundComplete = function () { gotoAndStop(1); }

      and my javascript to handle this....

      function f_playFile(fstring)
      player = document.getElementById('medplayer');

      the flash file is placed in teh page with...

      <object type="application/x-shockwave-flash" data="/soundfiles/sample.swf" id="medplayer" width="60" height="60">
      <param name="movie" value="/soundfiles/sample.swf" />

      and there a several links all of the form...

      <a href="javascript: f_playFile(' http://www.mysite.com/soundfiles/voice/bob.mp3');" title="Hear Bob">

      on clicking the link to invoke the javascript the flash file proceeds to frame 2 but no sound is ever played (even left it for a couple of minutes to see if it was downloading - mp3s are about 0.5M)

      If I hardcode the path (replacing audio in the loadSound with a full path) and place all that code in frame1 the sound is played successfully on page load.

      Can anyone suggest why the desired effect is not happening?

      Thanks in advance