# \[AS2\] Load external jpeg, setInterval, if exists

**URL:** https://forum.kirupa.com/t/as2-load-external-jpeg-setinterval-if-exists/277201
**Category:** flash
**Created:** [December 9, 2008, 12:44pm UTC](https://forum.kirupa.com/t/as2-load-external-jpeg-setinterval-if-exists/277201 "2008-12-09T12:44:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![xstevey\_bx](https://avatars.discourse-cdn.com/v4/letter/x/91b2a8/32.png) [@xstevey\_bx](https://forum.kirupa.com/u/xstevey_bx)
#### Post date: [December 9, 2008, 12:44pm UTC](https://forum.kirupa.com/t/as2-load-external-jpeg-setinterval-if-exists/277201/1 "2008-12-09T12:44:47Z")

</div>

I want to create dynamic slideshows using external jpegs and for the slideshow to continue until all of the images have been shown. The images in the folder are named 0,1,2,3… etc

First of all I want a function to fire that loads an external jpeg.  
It then checks to see if it exists.  
If it does it waits 5 seconds then loads the next.  
If it doesnt I want it to stop and show a default image.

So far I have

```php

fileExists=new LoadVars();
fileExists.onLoad=checkIt;

function checkIt(success) {
	if(success) {
		mc_slideshow.loadMovie("0.jpg");	
	} else {
		mc_slideshow.loadMovie("default.jpg");
	}
}

fileExists.load("0.jpg");

```

This checks to see if the image exists and if it does it gets displayed. If it doesnt it shows the default image.

How can I add a counter to the “0.jpg” and the

```php

fileExists.load

```

I Know it involves setInterval but I cant seem to get the two things working together!

Thanks for any help
