5 Replies Latest reply on May 3, 2010 12:22 PM by macrocream

    Flash Audio Integration

    macrocream

      Hi all;

       

      I currently have a flash file that has audio in it that isn't timeline based and is called to start playing via ActionScript using new sound();

       

      The file plays fine up until it is imported into presenter and published, just cant hear it. I verified the use of _root isnt used and for safety measures uses _lockroot = true;

       

      Thanks for any advice

        • 1. Re: Flash Audio Integration
          robva65 Level 2

          Macro,

           

          For starters, check your Actionscript and functions.  When using Flash, you're restricted to AS 2.0 and when envoking the Sound object, be sure the "case" is written correctly:

           

          var mySound:Sound = new Sound();

           

          Now depending on what you're looking to do with your audio file, the process for handling/manipulating/controlling that audio file will vary.  Having said that, what's the net result that you're looking for?  Simply to dynamically load the audio file?  Is it being called from a specific frame, or immediately on frame one as the .swf "plays"?

           

          Rob

           

          http://www.robrode.com/yabb/

          • 2. Re: Flash Audio Integration
            macrocream Level 1

            Thanks for the response. Here is an example of the code I am using. This is a simply play pause and in Presenter the audio will not even start. The intersting piece is the audio works if not in resenter. Tried different Player versions etc. I can open the swf off the desktop and all is well or off the intranet. Really interested to see what you come up with!!

             

            Here is the code:

             

            var snd:Sound = new Sound();
            snd.attachSound("sample");
            snd.start(snd.position/1000);
            audio_status = true;


            function audio() {
            if (audio_status == true) {
              _root.snd.stop();
              trace("hit");
              _root.stop();
              audio_status = false;
            } else {
              if (snd.position<snd.duration) {
               _root.snd.start(snd.position/1000);
               audio_status = true;
              } else {
               _root.snd.start();
               audio_status = true;
              }_root.play();
            }

            }

            audio_ctrl.onRelease = function() {
            audio();
            audio_ctrl.play();
            };

            • 3. Re: Flash Audio Integration
              robva65 Level 2

              Macro,

               

              It's not at all surprising that testing the .swf outside of Presenter works just as expected, but fails miserably within Presenter content.

               

              One of the biggest things right away is the use of _root.  With the exception of ONE instance where using _root is necessary to work with Presenter controls, the use of it in your code block is completely off-limits in this scenario as it will interfere with other calls for _root.play(); in Presenter.

               

              Additionally, any use of _global and _level are also frowned upon.

               

              What I'd suggest is using _parent and see if that gets you the results you're looking for.

               

              Otherwise, your code looks okay to me at this point.

               

              Rob

               

              http://www.robrode.com/yabb/

              • 4. Re: Flash Audio Integration
                macrocream Level 1

                Thanks,

                 

                I have used _lockroot = true and tried removing all references to _root. Here is the ipdated code in reference.

                 

                var snd:Sound = new Sound();
                snd.attachSound("sample");
                snd.start(snd.position/1000);
                audio_status = true;


                function audio() {
                if (audio_status == true) {
                   snd.stop();
                  stop();
                  audio_status = false;
                } else {
                  if (snd.position<snd.duration) {
                   snd.start(snd.position/1000);
                   audio_status = true;
                  } else {
                   snd.start();
                   audio_status = true;
                  }play();
                }

                }

                audio_ctrl.onRelease = function() {
                audio();
                audio_ctrl.play();
                };

                • 5. Re: Flash Audio Integration
                  macrocream Level 1

                  I have broken it down to this:

                   

                  var snd:Sound = new Sound();
                  snd.attachSound("sample");
                  snd.start(snd.position/1000);

                   

                  works fine except in Presenter