Handling Cue Points for Audio Files in ActionScript 2.0 and ActionScript 3.0

Flash ActionScript 2.0

Video has enjoyed a well-deserved spotlight lately in the Flash arena, in part because Google Video, YouTube.com, and Yahoo! Video all use the FLV file format.  Among other conveniences, the FLVPlayback Component makes it easy to incorporate cue points for synchronized endeavors, such as closed captioning.  Accolades are certainly in order, but let’s make sure not to forget good old MP3s.  :)   Audio presentations can be just as cool, and if you want cue points for those, you can either use the older Media Components — or you can add the functionality yourself (in ActionScript 2.0 or ActionScript 3.0!) as described in this Adobe Developer Center article:

http://www.adobe.com/devnet/actionscript/articles/cue_points_audio.html

4 Responses to “Handling Cue Points for Audio Files in ActionScript 2.0 and ActionScript 3.0”

  1. Tim Says:

    Hey - beginner AS2 actionscripter here! I just used your SoundSync class for one of my projects - It came in very handy, so thanks very much!

    Just one tiny thing I had to change , in the pollCuePoints function, where it goes:
    // Advance to next cue point …
    if (_currentCuePoint < _cuePoints.length) {
    _currentCuePoint++;
    } else {
    _currentCuePoint = getNextCuePointIndex(_secondOffset);
    }

    i had to change to (_currentCuePoint < _cuePoints.length-1)

    because otherwise when we’re on the final cuePoint , _currentCuePoint won’t reset, not until the next poll. For some reason , on the next poll when there arent any more cue points , even though the variable time evaluates to undefined, and span is NaN, the condition (position >= time && position <= span) returns true and an event is dispatched. weird hey!?

  2. David Stiller Says:

    Tim,

    Yeah, that is weird — and maybe I missed something important in my code! I’ll keep a reference to your input here and update the article on Adobe if I need to. Thanks so much for the feedback!

  3. Christian Says:

    Hi - Have you got any advice on using cuepoints for video with your “no-component” approach?

    Thanks for a great blog - your advice is much appreciated!!!

  4. David Stiller Says:

    Christian,

    I could write a blog entry or two on that topic. ;) Sounds like a good one. It’s added to the list.

Leave a Reply