6 Replies Latest reply on Dec 1, 2010 2:18 PM by oyvay

    Sound won't play when SWF file is inserted in HTML page--plays fine in Flash test movie

    oyvay

      I have created a SWF file that plays/stops sound. The SWF file works great when previewed in Flash CS4, but does not work when inserted in the HTML file.

       

      Here are the 2 files that are automatically generated when I INSERT>MEDIA>SWF in Dreamweaver CS4:

       

      swfobject_modified.js

      expressInstall.swf

       

      Here is the ActionScript3 that I am using in the Flash file:

       

      var req:URLRequest = new URLRequest("../Sound/dreamsSound1.mp3");
      var sound:Sound = new Sound();
      var controller:SoundChannel;

       

      function soundLoaded(event:Event):void
      {
          controller = sound.play();
          controller.stop();
          ListenYellow_btn.addEventListener(MouseEvent.CLICK, playSound);
          StopYellow_btn.addEventListener(MouseEvent.CLICK, stopSound);
      }

       

      function playSound(event:MouseEvent):void
      {
          controller = sound.play();
      }

       

      function stopSound(event:MouseEvent):void
      {
          controller.stop();
      }

       

      sound.addEventListener(Event.COMPLETE, soundLoaded);
      sound.load(req);