AS2 :: CuePoints Class

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

Copyright © 2008 Otuome Labs. All rights reserved.

sfy39587f11