# Externally loaded SWF files on click and automatically

**URL:** <https://forum.kirupa.com/t/externally-loaded-swf-files-on-click-and-automatically/312453>\
**Category:** flash\
**Created:** [August 3, 2010, 7:12pm UTC](https://forum.kirupa.com/t/externally-loaded-swf-files-on-click-and-automatically/312453 "2010-08-03T19:12:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lanawylma](https://avatars.discourse-cdn.com/v4/letter/l/58f4c7/32.png) [@lanawylma](https://forum.kirupa.com/u/lanawylma)\
**Post date:** [August 3, 2010, 7:12pm UTC](https://forum.kirupa.com/t/externally-loaded-swf-files-on-click-and-automatically/312453/1 "2010-08-03T19:12:59Z")

</div>

Hi… I would really like some help with the following…

I am creating a slide show that loads external SWFs on a button click as well as switching slides automatically… This is pretty much the exact example of the functionality:

[http://www.catgenie.com/](http://www.catgenie.com/)

I have the action script that loads external SWFs on a button click, but I don’t know how to make it so that the slides switch after a few seconds on their own as well as on a button click. I know it has to do with a timer - but I have no idea how to do that (i’m super new to AS) Can someone please either tell me what code I need there or direct me to a tutorial? I REALLY appreciate any help and THANK YOU ahead of time! Here’s the code I’m using so far:

var Xpos:Number = 0;  
var Ypos:Number = 0;  
var swf:MovieClip;  
var loader:Loader = new Loader();

var defaultSWF:URLRequest = new URLRequest(“swfs/one\_btn.swf”);

loader.load(defaultSWF);  
loader.x = Xpos;  
loader.y = Ypos;  
addChild(loader);

//Btns universal function (whenver any button is clicked, the loader will be removed

function btnClick(event:MouseEvent):void {

```
removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
loader.load(newSWFRequest);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);

```

}

/// Button Listerners  
one\_btn.addEventListener(MouseEvent.CLICK,btnClick);  
two\_btn.addEventListener(MouseEvent.CLICK,btnClick);  
three\_btn.addEventListener(MouseEvent.CLICK,btnClick);
