# Tell another swf to do something?

**URL:** <https://forum.kirupa.com/t/tell-another-swf-to-do-something/261382>\
**Category:** flash\
**Created:** [May 27, 2008, 4:36am UTC](https://forum.kirupa.com/t/tell-another-swf-to-do-something/261382 "2008-05-27T04:36:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnlouis](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/johnlouis/32/568_2.png) [@johnlouis](https://forum.kirupa.com/u/johnlouis)\
**Post date:** [May 27, 2008, 4:36am UTC](https://forum.kirupa.com/t/tell-another-swf-to-do-something/261382/1 "2008-05-27T04:36:12Z")

</div>

I have a bit of a problem.  
I am trying to build a site in Flash, and the structure i have in mind is like this:

Main movie  
|\_ Menu class / swf  
| |\_ Button class / instances  
|\_ Movie loader class / swf

so how do I let the buttons in my menu, which are in a different class/swf tell the MovieLoader class/swf to load something, and at the same time passing some values?

if I am looking at this wrong, I am open to suggestions on how I should build it… thanks!

---

<div class="post-metadata">

**Author:** ![johnlouis](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/johnlouis/32/568_2.png) [@johnlouis](https://forum.kirupa.com/u/johnlouis)\
**Post date:** [May 27, 2008, 9:55am UTC](https://forum.kirupa.com/t/tell-another-swf-to-do-something/261382/2 "2008-05-27T09:55:49Z")

</div>

i saw this method from another site, and tried it out.  
i tried adding a MouseEvent.CLICK listener to each **Button** instance in **Menu** class / swf, which just dispatches the event.

```auto

button_instance.addEventListener(MouseEvent.CLICK, clickHandler);
private function clickHandler(e:MouseEvent):void{
    dipatchEvent(e);
}

```

Then in my **Main** movie, I add another CLICK listener to the **Menu** class / swf with useCapture set to ‘true’ to trace what object is clicked. It is tracing the different components of the **Button** instance (Sprites, TextFields), and not the Button itself…  
any ideas?

```auto

menu.addEventListener(MouseEvent.CLICK, menuClickHandler, true);
private function menuClickHandler(e:MouseEvent):void{
    trace (e.target);
}

```
