# DispatchEvent between classes

**URL:** <https://forum.kirupa.com/t/dispatchevent-between-classes/278848>\
**Category:** flash\
**Created:** [January 6, 2009, 5:18pm UTC](https://forum.kirupa.com/t/dispatchevent-between-classes/278848 "2009-01-06T17:18:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbdvd7](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@dbdvd7](https://forum.kirupa.com/u/dbdvd7)\
**Post date:** [January 6, 2009, 5:18pm UTC](https://forum.kirupa.com/t/dispatchevent-between-classes/278848/1 "2009-01-06T17:18:27Z")

</div>

I am switching from Flash to Flex and encountering some problems. I have a few classes defining my site structure:  
location  
index  
main  
concept  
etc…

The document class is Main.as it calls location, index, etc. Location pops up first, when a location is chosen, it tells Index what to display based on the location. Then I try to

dispatchEvent(“locationEvent”, true));

to alert Main from Index to move to that page.  
In main I have

this.addEventListener(“locationEvent”, loadPages);

but nothing is called. What am I missing? Is this even a good practice for site structure? Does the placement of the eventListener matter? Where else could I put it or call it from the index class?

Thanks in advance
