# Dispatch event and external swf

**URL:** <https://forum.kirupa.com/t/dispatch-event-and-external-swf/316134>\
**Category:** Uncategorized\
**Created:** [November 13, 2010, 6:30pm UTC](https://forum.kirupa.com/t/dispatch-event-and-external-swf/316134 "2010-11-13T18:30:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lope](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@lope](https://forum.kirupa.com/u/lope)\
**Post date:** [November 13, 2010, 6:30pm UTC](https://forum.kirupa.com/t/dispatch-event-and-external-swf/316134/1 "2010-11-13T18:30:44Z")

</div>

I am loading an external swf into one class and in the external swf I am dispatching event like so:

```auto
dispatchEvent(new NavigationEvent(NavigationEvent.NAVIGATION_CHANGE, id));

```

now when i load this swf and cast is as object and try to add a listener:

```auto
 
private var _categoryNavigation:Object;
 
//when it loads
_categoryNavigation = _loader.content;
_categoryNavigation.addEventListener(NavigationEvent.NAVIGATION_CHANGE, categoryRangeChange);

```

i get a some weird error on runtime when it tries to dispatch an event:

```auto
 
TypeError: Error #1034: Type Coercion failed: cannot convert events::NavigationEvent@20a4e641 to events.NavigationEvent.
 at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()

```
