#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0

    onSoundComplete?


    i cannot seem to get this function to work for an event sound (a non-streaming sound)

    i am trying to be able to determine when an event sound is completed

    the onSoundComplete function doesnt' seem to be detecting it properly.

    this is my current code. it is a recursive function to play sequentially through sound objects which are referenced in an array. there are objects which contain Sound objects called sample, which have an instance name that coincide with what is stored in the array. can anyone see why the sounds that i am trying to play sequentially are all playing at the exact same time (or need any other info that can help you help me:)? (or, if anyone has a better, smarter way to accomplish this, feel free to release me from my headache)

    THANKS!

    (this is initially called as playX(0); )

    function playX(pos)
    {
    if (pos < myArray.length)
    {
    eval(myArray[pos]).sample.start();
    eval(myArray[pos-1]).sample.onSoundComplete = playX(++pos);
    }
    }
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0
    i figured this one out, if anyone else is ever searching for something like this

    in other news, the way i got it was an anonymous function, because i was trying the callback function with a parameter, and i'm not sure if that's possible...(is that possible?)
    anyway, here is my new function for all you people out there just like me...

    function playX(pos) {
    if (pos<myArray.length) {
    eval(myArray[pos]).sample.start();
    eval(myArray[pos]).sample.onSoundComplete = function() {
    playX(++pos);
    };
    } else {
    trace("returning at pos "+pos);
    }
    }

    love,
    the centaur

IMN logo majestic logo threadwatch logo seochat tools logo