A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash Sound

  1. #1
    Webmong
    Join Date
    Mar 2004
    Location
    London UK
    Posts
    24

    Flash Sound

    Hi all

    I have two Sound loops in my flash movie and I would like to have "loop_1" play once and then immediately after "loop_2" starts and then loops forever. can this be done without a gap between the loops.

    Cheers
    Chris

  2. #2
    Member
    Join Date
    Jul 2004
    Posts
    36
    i imaginthe problem is the loading between the end of 1 and the start of 2.

    at the beggining of the first loop, load the 2nd and then stop it straight away. use get sound duration and get sound played to determine when 1 has finished then play 2 again use duration and played to know when to restart the sound.

  3. #3
    Webmong
    Join Date
    Mar 2004
    Location
    London UK
    Posts
    24
    Hi mate

    I actualy found the code below and it does what I want but for some reason there is a slight gap/delay between the first stoping and the second starting.

    here is the code.....what do you think? is there a better way to do this or do you know of a way the get rid of the gap.

    PHP Code:
    stop();

    introSound = new Sound();
    introSound.attachSound("intro");

    trackSound = new Sound();
    trackSound.attachSound("track");

    cymbolSound = new Sound();
    cymbolSound.attachSound("cymbol");

    introSound.start();

    introSound.onSoundComplete = function() {  
    trackSound.start(0,16);
    cymbolSound.start();
    }

    trackSound.onSoundComplete = function() {  
    introSound.start();
    cymbolSound.start();

    Cheers
    Chris

  4. #4
    Running Plodding & Limping SpockBert's Avatar
    Join Date
    Jun 2002
    Location
    London
    Posts
    593
    that code above looks pretty good to me, thats probably the way I'd got about doing it, 2 sound objects then use a onSoundComplete function to start looping "loop_2".

    only thing that I question in that code is they haven't declared where each sound object is to be located.

    i mean they got:

    introSound = new Sound();

    and I think it should be:

    introSound = new Sound(this); //to load the object on the timeline where this code is placed

    or:

    introSound = new Sound(_root.myMC); // a movieclip to contain that sound.

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