# EventDispatcher

**URL:** <https://forum.kirupa.com/t/eventdispatcher/279748>\
**Category:** flash\
**Created:** [January 18, 2009, 10:01pm UTC](https://forum.kirupa.com/t/eventdispatcher/279748 "2009-01-18T22:01:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chapster](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@chapster](https://forum.kirupa.com/u/chapster)\
**Post date:** [January 18, 2009, 10:01pm UTC](https://forum.kirupa.com/t/eventdispatcher/279748/1 "2009-01-18T22:01:11Z")

</div>

I have a class called SlideShow that extends Sprite. I also have a reference to a calls called bio which also extends a Sprite. In the SlideShow class I have a dispacthEvent that fires in a function. The problem I’m getting is the listener in the Bio class is not listening correctly. I thought this would bubble up as both Sprites are of the same parnet.

**SlideShow Class**

```auto

package com.slideshow {
	
	import flash.display.Sprite;
	import flash.events.Event;
	import com.slideshow.Bio;
	
	
	public class SlideShow extends Sprite{
		
		private var _bio : Bio;
		
		public function SlideShow( ){
			init();
			onShowNextSlide( 0 );
		}
		
		private function init() : void {
			_bio = new Bio();
			_bio.x = 620;
			_bio.y = 12;
			addChild(_bio);
			
		}
		
		public function onShowNextSlide( ID : Number ) : void {
			dispatchEvent(new Event('onNextSlide')); 
			onStartSlideChange( ID );
			
		}

```

**Bio Class**

```auto

package com.slideshow {
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class Bio extends Sprite{
		
		
		public function Bio(){
			this.alpha = 0;
			this.addEventListener('onNextSlide', onRefresh );
			
		}
		
		private function onRefresh( evt : Event ) : void {
			trace("Refresh Bio");
		}

	}
}

```

It works if I use the line

```auto

_bio.dispatchEvent(new Event('onNextSlide')); 

```

But the problem with the above is I will have other classes that need to listened for the same dispatched event. Lets say I had 2 bio Sprites that needed to listen to the same event.
