A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [F8] making sound pause or wait

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jan 2006
    Location
    USA
    Posts
    383
    Why would it?

    All you're doing is waiting until you play the next song..

    You could even use intervals.

    PHP Code:
    var delayInterval:Number setInterval(delay1000 30);
    var 
    count:Number 0;
    var 
    time:Number 10;

    function 
    delay() {
       if(
    count == time) {
          
    playSong(next);
          
    clearInterval(delayInterval);
       } else {
          
    count++;
       }


  2. #2
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    this will repeat 2 songs with a 3 second gap between them.
    it assumes you have 2 songs in your library named s1 and s2.
    3000 is milliseconds - so set it to what you need


    _root.createEmptyMovieClip("sound1",1);
    _root.createEmptyMovieClip("sound2",2);
    s1 = new Sound(sound1);
    s2 = new Sound(sound2);
    s1.attachSound("s1");
    s2.attachSound("s2");
    s1.start();
    s1.onSoundComplete = function() {
    delay(s2);
    }
    s2.onSoundComplete = function() {
    delay(s1);
    }
    function delay(sound) {
    sound.del = setInterval(setDelay,3000,sound);
    }
    function setDelay(sound) {
    sound.start();
    clearInterval(sound.del);
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center