# uiLoader and Animated Buttons?

**URL:** <https://forum.kirupa.com/t/uiloader-and-animated-buttons/324168>\
**Category:** flash\
**Created:** [August 5, 2011, 8:32pm UTC](https://forum.kirupa.com/t/uiloader-and-animated-buttons/324168 "2011-08-05T20:32:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BunEm](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@BunEm](https://forum.kirupa.com/u/BunEm)\
**Post date:** [August 5, 2011, 8:32pm UTC](https://forum.kirupa.com/t/uiloader-and-animated-buttons/324168/1 "2011-08-05T20:32:56Z")

</div>

Hello, I am trying to control external swf’s using uiLoader and animated buttons. I have not done flash in some time so AS3 is new to me.

Basically, I want to use uiLoader to call for external swf’s to load in inside a flash webpage.

```auto
but1.addEventListener(MouseEvent.CLICK, loadsSWF);
but2.addEventListener(MouseEvent.CLICK, loadsSWF);
but3.addEventListener(MouseEvent.CLICK, loadsSWF);
but4.addEventListener(MouseEvent.CLICK, loadsSWF);
but5.addEventListener(MouseEvent.CLICK, loadsSWF);
function loadsSWF(event:MouseEvent):void{
   if(event.target.name=="but1"){uiLoader.source=null;uiLoader.source="home.swf";} else
   if(event.target.name=="but2"){uiLoader.source=null;uiLoader.source="media1.swf";} else
   if(event.target.name=="but3"){uiLoader.source=null;uiLoader.source="project1.swf";} else
   if(event.target.name=="but4"){uiLoader.source=null;uiLoader.source="news1.swf";} else
   if(event.target.name=="but5"){uiLoader.source=null;uiLoader.source="contact.swf"; }
}

```

This works fine. I also want to call those pages using nice animated buttons. Because animated buttons seem to be so different in AS3, I am having a hard time making both of them work. I am using the following for the buttons. Individually, these 2 thing work fine. However, I do not know how I would combine the 2 to make them work together. I cannot use the animated buttons using this method to call on the external swfs (or rather, I do not know how).

```auto
stop();

var rewind:Boolean = false;
l2o.addEventListener(MouseEvent.ROLL_OVER,growUP);
l2o.addEventListener(MouseEvent.ROLL_OUT,growDown);

l2o.buttonMode = false;
l2o.useHandCursor = true;

function growUP(e:MouseEvent):void{
play();
rewind = false;
}

function growDown(e:MouseEvent):void{
rewind = true;
}

this.addEventListener(Event.ENTER_FRAME,revFrame);
function revFrame(e:Event):void{
if(rewind == true){
prevFrame();
}
}

```

Any help would be appreciated. Thanks!
