3 Replies Latest reply on Oct 24, 2009 12:06 PM by Stachi1410_91

    Song's start in random place.

    Stachi1410_91

      Hi. This is my first post on another forum:

       

      "Hi. I made flash player and i used that tutorial: HERE.
      Everything is good, but when one song is ending, next song's start is delay about 1-2 sec. You can say that is nothing in flash mp3 player, but if each other song is one short speaker sentence(there are about 10 one by one) it may be nervous. Can someone tell me how to delete that delay? I don't need to have xml playlist. Just i want to start one by one(all playlist is about 300-400 loop/songs/mp3 files) without delay. Those files aren't big. Please help me. And sorry for my bad language. Greetings."

       

      Now I think there is no way to delete that delay(if I am wrong, please tell me how i can do it), but i have another idea. I will make one big file from 10 or 20 of that smaller, but i need to have in my player one thing more. When user will press start button, song won't start at 00:00/xx:xx but in random place. You know what i mean ? It will not start at start but somewhere else, in random place(maybe 00:21/xx:xx or 02:47/xx:xx or 01:02/xx:xx). Can you help me with it? Bye.

       

      Action script:

       

      stop();
      _soundbuftime = 1;
      playlist = new XML();
      playlist.ignoreWhite = true;
      playlist.onLoad = function(success) {
          if (success) {
              _global.songfile = [];
              for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
                  _global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
                  trace(songname[i]+"  "+songfile[i]);
              }
          }
          _root.createEmptyMovieClip("sound_mc", 1);
          _root.sound_mc.sound_obj = new Sound();
          _global.song_nr = random(songfile.length);
          _root.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
      };
      MovieClip.prototype.songStarter = function(file, name) {
          this.sound_obj.loadSound(file, true);
          this.onEnterFrame = function() {
             
          };
          this.sound_obj.onSoundComplete = function() {
              clearInterval(timeInterval);
              (song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
              _root.sound_mc.songStarter(songfile[song_nr]);
          };
      };
      btn_play.onRelease = function() {
          if (pause == true){ // no comment....
              this._parent.sound_mc.sound_obj.start(posiP) // start sound from the previously saved position
          }
          else {
          this._parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
          };
      };
      btn_stop.onRelease = function() {
          this._parent.sound_mc.sound_obj.stop();
      };
      pause_button.onRelease = function() { //pause button function
          this._parent.sound_mc.sound_obj.stop(); //stop the current sound
          posiP = _root.sound_mc.sound_obj.position / 1000; // save the current position in a new variable and divide by 1000 (ms -> sec)
          pause = true;//set the variable pause to true
      };
      goback_button.onRelease = function() {
          stopAllSounds();
          gotoAndPlay(1);
      };
      btn_fw.onRelease = function() {
          (song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
          _root.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
      };
      btn_rev.onRelease = function() {
          (song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;
          _root.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
      };
      playlist.load("playlist2.xml");