Video and Audio Captions

Today, I was working on a Video and Audio CD that will accompany elementary and intermediate level language textbooks; and our instructors asked me to incorporate close caption to every video and audio exercise on the CD. So here is a simple example on how to read video/audio metadata:

<xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>    
            import mx.utils.ObjectUtil;
            import mx.events.CuePointEvent;

            private function getCuePoint(event:CuePointEvent):void {
                var cuePointObj:Object = null;
                var obj:Object;
                var cuePointArr:Array = videoDisplay.metadata.cuePoints;
                var idx:uint;
                var len:int = cuePointArr.length;
                for (idx = 0; idx < len; idx++) {
                    if (cuePointArr[idx].name == event.cuePointName) {
                        cuePointObj = cuePointArr[idx];
                    }
                }
                trace(event.cuePointName, ObjectUtil.toString(cuePointObj));
            }
    </mx:Script>
    <mx:VideoDisplay id="videoDisplay"
            source="example.flv"
            cuePoint="getCuePoint(event);" />
</mx:Application>


Enjoy, :)!