CustomDispatcher

Package:
Class:
Inheritance:
biz.flashscript.events
public class CustomDispatcher
EventDispatcher
The CustomDispatcher class has a timer to cause a delay. Then a custom event is fired. Use the constructor new CustomDispatcher().
Public Methods
Method Defined By
CustomDispatcher()
Creates a new instance of the CustomDispatcher class.
CustomDispatcher
doAction (delay:int, repeat:int)
Initiates a timer.
CustomDispatcher
Events
Event Defined By
All inherited events of the EventDispatcher class. EventDispatcher
Constructor Detail
CustomDispatcher ()  Constructor
public function CustomDispatcher()
Intializes a new CustomDispatcher instance.
Method Detail

doAction(delay:int, repeat:int)

This method will initiate creating the grid.

Parameters

  • delay:int ____ Specifies the timer delay.
  • repeat:int ____ Specifies the timer frequency.
Examples
Create an Actionscript file and put the script from below. Name the file DispatcherTest.as. Create a new fla file and name it CustomDispatcher.fla. Place the fla and .as file in the same folder as the biz folder. In the Document class textbox add DispatcherTest. Then test the movie.

package 
{
	import flash.display.Sprite;
	import biz.flashscript.events.CustomDispatcher;
	public class DispatcherTest extends Sprite
	{
		private var myDispatcher:CustomDispatcher;
		public function DispatcherTest ():void
		{
			myDispatcher=new CustomDispatcher  ;
			myDispatcher.addEventListener (CustomDispatcher.ACTION, detectRoot);
			myDispatcher.doAction (1, 1000);
		}
		private function detectRoot (e:Event):void
		{
			if (root != null)
			{
				e.target.removeEventListener (CustomDispatcher.ACTION, detectRoot);
				trace (root);
			}
		}
	}
}