# Pass mouseevent from loaded MC to Parent

**URL:** <https://forum.kirupa.com/t/pass-mouseevent-from-loaded-mc-to-parent/281003>\
**Category:** flash\
**Created:** [February 3, 2009, 8:21pm UTC](https://forum.kirupa.com/t/pass-mouseevent-from-loaded-mc-to-parent/281003 "2009-02-03T20:21:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattdennis3](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mattdennis3](https://forum.kirupa.com/u/mattdennis3)\
**Post date:** [February 3, 2009, 8:21pm UTC](https://forum.kirupa.com/t/pass-mouseevent-from-loaded-mc-to-parent/281003/1 "2009-02-03T20:21:53Z")

</div>

I am trying to learn AS3 and have been working through a tutorial. It is basically a photo gallery, that when you click a thumbnail it loads a large image. I have now decided to try and adapt it and learn more AS3 at the same time. Basically I would like to load a SWF instead of a large image. The problem I have run into, is that I can’t figure out how to close the loaded MC once you are done view it. I have a close button in the loaded MC, but I can’t seem to get it to send the right info in order to call a function in the parent MCs timeline. Below is just some partial code.

Function in loaded MC:  
function closeMe(e:MouseEvent):void  
{  
var mc\_container:MovieClip = MovieClip(this.parent.parent.parent);

```
mc_container.removeFull(e);

```

}

Function on parent main timeline:  
function removeFull(e:MouseEvent):void{  
var my\_loader:Loader = Loader (e.currentTarget);  
full\_tween = new Tween(my\_loader, “alpha”, Strong.easeOut, 1,0,0.5, true);  
full\_tween.addEventListener(TweenEvent.MOTION\_FINISH, tweenFinished);

```
    container_mc_tween = new Tween(container_mc, "alpha", Strong.easeOut, 0.5,1,0.5, true)

```

}

This is the error I see in the output window:  
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@469acf81 to flash.display.Loader.  
at gallery\_fla::MainTimeline/removeFull()  
at tester\_fla::MainTimeline/closeMe()

I’m guessing the problem is that I need to figure out a way to pass the mouse click on my close button, to the removeFull function on my main timeline.

Any help would be greatly appreciated.

Thanks
