# DispatchEvent to parent not working

**URL:** <https://forum.kirupa.com/t/dispatchevent-to-parent-not-working/296121>\
**Category:** flash\
**Created:** [September 9, 2009, 7:46pm UTC](https://forum.kirupa.com/t/dispatchevent-to-parent-not-working/296121 "2009-09-09T19:46:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitech](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nitech/32/2542_2.png) [@nitech](https://forum.kirupa.com/u/nitech)\
**Post date:** [September 9, 2009, 7:46pm UTC](https://forum.kirupa.com/t/dispatchevent-to-parent-not-working/296121/1 "2009-09-09T19:46:39Z")

</div>

Hey fellow Kirupians,

I am very new to AS3. As I’m working on a simple XML photo gallery, I am having a bit of trouble making my Slide class successfully dispatch an MOUSE\_OVER and MOUSE\_OUT event to the Main class.

Main.as

```auto
// add a new slide
var slide:Slide = new Slide(_slideHolder, "slide_" + no, _xml.img[no], x, no);
slide.addEventListener(Event.COMPLETE, imageLoaded);
slide.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
slide.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
_slides.push(slide);

```

Slide.as (extends ImageLoader.as which Extends EventDispatcher)

```auto
public override function loaded(e:Event):void {
	// assign some events
	_image.addEventListener(MouseEvent.ROLL_OVER, mouseOver);
	_image.addEventListener(MouseEvent.ROLL_OUT, mouseOut);
	TweenPlugin.activate([ColorMatrixFilterPlugin]);			
	
	// tell parent we've loaded
	dispatchEvent(new Event(Event.COMPLETE));
}

```

Further, I have the two following functions:

```auto
public function mouseOver(e:MouseEvent):void {
	dispatchEvent(new MouseEvent(MouseEvent.ROLL_OVER));
}

public function mouseOut(e:MouseEvent):void {
	dispatchEvent(new MouseEvent(MouseEvent.ROLL_OUT));
}	

```

When I hover over my sprites, the functions inside Slide.as gets triggered - but they don’t pass the event to Main.as as I would have expected.

Strange thing is that the Event.COMPLETE gets triggered inside Main.as.

What am I doing wrong?

Kind regards,  
Nitech
