AS2 :: CuePoints Class
Submitted by hasan on Sun, 07/16/2006 - 07:00.
Goal: Wanted to simplify cue point usage for FLVs that needed text captions. The repetitive static code is placed in the class file leaving the dynamic stuff for the FLA.
import mx.utils.Delegate;
class labs.otuome.utils.CuePoints
{
private var _vid;
private var _arr:Array;
private var _ct:TextField;
private var _cf:Function;
public function CuePoints(co:Object)
{
_vid = co.video;
_arr = co.cues;
_ct = co.textbox;
_cf = co.animation;
_vid.addEventListener("cuePoint", Delegate.create(this,_onCue));
}//end constructor
private function _onCue(cue:Object):Void
{
for (var i=0; i<_arr .length; i++)
{
if (cue.info.name == _arr[i].cueName)
{
_ct.text = _arr[i].cueText;
_cf();
}
}
}//end function
}//end class

