Custom Event Dispatcher


So I have a small game where I have implemented a* path finding. I have a spot where a player moves around the screen along the path found. I have a section where i know the user is at the end of the path and I am looking to dispatch an event at this moment so I can do things at the end of the path.

i have imported the aStar_path_dispatcher file into the move class then i do,


at the spot where i know the path movement is finished.

my aStar_path_dispatcher class looks like this:

package com.aStar {
	public class aStar_path_dispatcher extends EventDispatcher {
		public static var ON_FINISH_MOVE:String = "Move Finished";
		public function aStar_path_dispatcher(){
		}//end constructor
		public function dispatchFinishMove():void{
			dispatchEvent(new Event(aStar_path_dispatcher.ON_FINISH_MOVE));
			trace("event fired");
		}//end dispatchFinishMove
	}//end class
}//end package

and it does trace “event fired”.

then in my main document class i import the aStar_path_dispatcher again, and set up an instance of it: then add a listener:

aStarDispatch.addEventListener(aStar_path_dispatcher.ON_FINISH_MOVE, aStarMoveFinished);


private function aStarMoveFinished(e:Event){
			trace("Move finished");
		}//end move Finished

however this “move finished” doesn’t seem to want to work. I have never used custom events before, so I must be doing something stupidly wrong. Any help is appreciated thanks.