# dispatchEvent; What am I doing wrong?!

**URL:** <https://forum.kirupa.com/t/dispatchevent-what-am-i-doing-wrong/285818>\
**Category:** flash\
**Created:** [April 6, 2009, 11:29pm UTC](https://forum.kirupa.com/t/dispatchevent-what-am-i-doing-wrong/285818 "2009-04-06T23:29:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greetification](https://avatars.discourse-cdn.com/v4/letter/g/3bc359/32.png) [@greetification](https://forum.kirupa.com/u/greetification)\
**Post date:** [April 6, 2009, 11:29pm UTC](https://forum.kirupa.com/t/dispatchevent-what-am-i-doing-wrong/285818/1 "2009-04-06T23:29:56Z")

</div>

Hi everyone, I don’t know if i’ve been in front of my computer for too long, but I can’t for the life of me understand why this doesn’t work:

All i’m trying to do is dispatch an event from one class to the other, when I trace it out, it says the event is getting added, but the event listener isn’t picking anything up.

Main.as

```auto

package {
	import Test;
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class Main extends Sprite {
		public function Main() {
			var newTest:Test = new Test();
			addChild(newTest);
			newTest.addEventListener("test", tester, false, 0, true);
		}
		
		private function tester(e:Event):void {
			trace("why didn't this work?");
		}
	}
}

```

Test.as

```auto

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	public class Test extends Sprite {
		public function Test() {
			dispatchEvent(new Event("test", true, false));
        	}
	}
}

```

Thanks!
