5 Replies Latest reply on Mar 9, 2007 5:02 AM by Newsgroup_User

    Sound Object

    Arunkkumar2207j Level 1
      Can we load sound dynamically without playing...........
        • 1. Re: Sound Object
          Level 7
          Arunkkumar2207j,

          > Can we load sound dynamically without playing...........

          Yes.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Sound Object
            prafulka Level 1
            Try this may be solve your problam

            var myNumber:Number = new Number();
            var the_sound:Sound = new Sound();
            the_sound.onLoad = function(success:Boolean) {
            var totalSeconds:Number = this.duration/1000;
            trace(this.duration+" ms ("+Math.round(totalSeconds)+" seconds)");
            var minutes:Number = Math.floor(totalSeconds/60);
            var seconds = Math.floor(totalSeconds)%60;
            if (seconds<10) {
            seconds = "0"+seconds;
            }
            trace(minutes+":"+seconds);
            };
            the_sound.loadSound("yoursound.mp3", true);
            stop_btn.onRelease = function() {
            trace("sound stopped"+the_sound.duration);
            myNumber = Math.round(the_sound.position/1000);
            the_sound.stop();
            };
            play_btn.onRelease = function() {
            trace("sound started"+the_sound.duration);
            the_sound.start(myNumber);
            };
            • 3. Re: Sound Object
              Arunkkumar2207j Level 1
              Thanks "David",

              Purpose is Player should play one song from playlist and download next without playing, so that buffering times is reduced.
              • 4. Re: Sound Object
                Arunkkumar2207j Level 1
                Thank You i have completed my task to some extend.

                Thanks
                • 5. Re: Sound Object
                  Level 7
                  Arunkkumar2207j,

                  > Purpose is Player should play one song from playlist and
                  > download next without playing, so that buffering times is
                  > reduced.

                  Take a look at the Sound.load() method; you'll see that the second
                  parameter is optional and defaults to false. When that parameter is set to
                  false, the MP3 file loads, but does not begin playing until you invoke
                  Sound.start(). You can check the value of Sound.getBytesLoaded() against
                  getBytesTotal() repeatedly -- such as in a setInterval() loop -- to
                  determine how far along the sound has loaded; or react to the
                  onSoundComplete event.


                  David Stiller
                  Adobe Community Expert
                  Dev blog, http://www.quip.net/blog/
                  "Luck is the residue of good design."