Posted in Adobe, Flash
07/16 2006

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 org.thesourcecode.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

Download the easy-install extension from here.
Documentation can be found here.

This Post tags: ,

 

USER COMMENTS

Track comments via RSS 2.0 feed. Feel free to post the comment, or trackback from your web site.

Currently there are no comments related to article "AS2 :: CuePoints Class".

Get Adobe Flash playerPlugin by wpburn.com wordpress themes