# Mouse Events and Button Mode in externally loaded swfs

**URL:** <https://forum.kirupa.com/t/mouse-events-and-button-mode-in-externally-loaded-swfs/285452>\
**Category:** flash\
**Created:** [March 31, 2009, 11:46pm UTC](https://forum.kirupa.com/t/mouse-events-and-button-mode-in-externally-loaded-swfs/285452 "2009-03-31T23:46:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tsukiyomi](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tsukiyomi](https://forum.kirupa.com/u/Tsukiyomi)\
**Post date:** [March 31, 2009, 11:46pm UTC](https://forum.kirupa.com/t/mouse-events-and-button-mode-in-externally-loaded-swfs/285452/1 "2009-03-31T23:46:34Z")

</div>

I’ve looked around on this forum and others looking for an answer to this and I haven’t found anything thats worked. If I missed the answer on here I apologize for the repeating topic.

I have an external swf I created, I used the Document Class to place assetts from the library onto the stage. I have a few Movie Clips I set the buttonMode to true on and added a few MouseEvents for when they’re clicked on or rolled over to load content and make a few draggable.

It works perfectly in that swf, but since most of my assets are in the library and exported on Frame 1 I can’t really use an internal preloader on it. So what I did was create an external swf that all it is is a loader that I add to the stage that loads the first swf I created.

That works perfectly for getting it on the stage, but the Movie Clips no longer are recognized as buttons and the mouse events aren’t working anymore.

Is there anything I can do to change this?

Here is the code I’m using to load the external swf:

```auto
var a:URLRequest = new URLRequest("timeline2.swf");
var b:Loader = new Loader();
b.load(a);
addChild(b)

```

Simple enough.

This is the code I used to add listeners in the external swfs document class:

```auto

stage.addEventListener(MouseEvent.MOUSE_UP, stopAllDrags);
//
btn_1968.addEventListener(MouseEvent.CLICK, setYear);
btn_1968.xIndex = 0;
btn_1968.buttonMode = true;
//
btn_1970.addEventListener(MouseEvent.CLICK, setYear);
btn_1970.xIndex = 1;
btn_1970.buttonMode = true;
//
btn_1979.addEventListener(MouseEvent.CLICK, setYear);
btn_1979.xIndex = 2;
btn_1979.buttonMode = true;
//
btn_1979b.addEventListener(MouseEvent.CLICK, setYear);
btn_1979b.xIndex = 3;
btn_1979b.buttonMode = true;
//
btn_1983.addEventListener(MouseEvent.CLICK, setYear);
btn_1983.xIndex = 4;
btn_1983.buttonMode = true;
//
btn_1985.addEventListener(MouseEvent.CLICK, setYear);
btn_1985.xIndex = 5;
btn_1985.buttonMode = true;
//
btn_1991.addEventListener(MouseEvent.CLICK, setYear);
btn_1991.xIndex = 6;
btn_1991.buttonMode = true;
//
btn_1995.addEventListener(MouseEvent.CLICK, setYear);
btn_1995.xIndex = 7;
btn_1995.buttonMode = true;
//
btn_2001.addEventListener(MouseEvent.CLICK, setYear);
btn_2001.xIndex = 8;
btn_2001.buttonMode = true;
//
btn_2008.addEventListener(MouseEvent.CLICK, setYear);
btn_2008.xIndex = 9;
btn_2008.buttonMode = true;

```

Any help would be greatly appreciated.
