Skip to content
wezside edited this page Apr 7, 2011 · 4 revisions

Below is a list of all the Utilities found in the Toolkit with a short descirption and example.

DateUtil

FileUpload

FileUtil

FlashVars

ImageResize

Reflection

SharedObjUtil

A useful class to manage application state. The reserved property on an IState instance is used for application state that will only affect itself. Reserved states are not mutually exclusive, they are allowed to co-exist with non-reserved and other reserved states. The StateManager is very powerful and the thought behind it is explained in more detail here.

	var sm:StateManager = new StateManager();
	sm.addState( "Credentials", true );
	sm.addState( "Register" );
	sm.addState( "List" );
	sm.addState( "Search" );
	sm.addState( "Results" );
	
	sm.state = "Credentials";				// State == 1
	sm.state = "Credentials";				// State == 0
	sm.state = "Credentials";				// State == 1
	sm.state = "Register";					// State == 3
	sm.previousState().key					// Result is "Credentials"	
	sm.state = "Credentials";				// State == 2

StringUtil

StyleManager

TimelineManager

A simple class to deal with timeline animations. Manage timeline animations playback, removal and end frame behaviour. A play policy exist to allow for playing back multiple animations at once or in sequence starting at a specific animation or simply play a single (default) animation.

	public function VisualTestTimelineManager()
	{
		tm = new TimelineManager();			
		mc1 = new Animation01();
		mc2 = new Animation02();		
		mc3 = new Animation03();
		tm.addEventListener( TimelineEvent.READY, ready );
		tm.addEventListener( TimelineEvent.COMPLETE, complete );
		tm.addEventListener( TimelineEvent.SEQUENTIAL_COMPLETE, sequenceComplete );
		tm.addElement( "1", mc1, 0, -1, false,  TimelineManager.CHILD_POLICY_RECURSIVE );
		tm.addElement( "2", mc2, 0, 30, false, TimelineManager.CHILD_POLICY_RECURSIVE );
		tm.addElement( "3", mc3, 0, -1, false, TimelineManager.CHILD_POLICY_RECURSIVE );
											
		addChild( mc3 );
		addChild( mc2 );			
		addChild( mc1 );				
	}

	private function complete( event:TimelineEvent ):void 
	{
		trace( "End Frame reached " + event.index );
	}

	private function ready( event:TimelineEvent ):void 
	{
		if ( event.total == 3 )
		{
			tm.play();
		}
	}

	protected function sequenceComplete( event:TimelineEvent):void
	{
		trace( "Sequence complete ");					
		mc1.removeChildAt(0);
		mc2.removeChildAt(0);
		mc3.removeChildAt(0);
		removeChild( mc3 );
		removeChild( mc2 );			
		removeChild( mc1 );
		
		Animation01 = null;
		Animation02 = null;
		Animation03 = null;
		
		tm.purge();
		tm = null;				
		mc1 = null;
		mc2 = null;		
		mc3 = null;			
	}		

Tracer

TrackingUtil

Validator