# Detecing Image Before Loading

**URL:** https://forum.kirupa.com/t/detecing-image-before-loading/185052
**Category:** flash
**Created:** [April 10, 2006, 4:10pm UTC](https://forum.kirupa.com/t/detecing-image-before-loading/185052 "2006-04-10T16:10:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jflint](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jflint/32/2115_2.png) [@jflint](https://forum.kirupa.com/u/jflint)
#### Post date: [April 10, 2006, 4:10pm UTC](https://forum.kirupa.com/t/detecing-image-before-loading/185052/1 "2006-04-10T16:10:59Z")

</div>

Is it possible with actionscript to detect if an image is present before loading it?

For instance I am using loadMovie to load an external jpeg.

```auto
instanceName.loadMovie("/folder/image.jpg");

```

Is there any way I can test to see if that image exists using Actionscript, then tell the timeline to do something else if it is not there?

---

<div class="post-metadata">

### Author: ![Satish](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Satish](https://forum.kirupa.com/u/Satish)
#### Post date: [April 11, 2006, 2:39am UTC](https://forum.kirupa.com/t/detecing-image-before-loading/185052/2 "2006-04-11T02:39:56Z")

</div>

checkImageExist(“Images/test.jpg”);  
function checkImageExist(imageURL) {  
//--------------- image url from the attribute of the component -----------  
//----------- loadvars are used to check the whether the image exists are not ----------  
var imageURL = imageURL  
var imgLoadVars = new LoadVars();  
imgLoadVars.load(imageURL);  
imgLoadVars.parent = this;  
imgLoadVars.onLoad = function(success) {  
if (success) {  
trace("-------- Image exist ---------------"+imageURL);  
mcImgHolder.loadMovie(imageURL);  
startEnterFrame();  
} else {  
trace("-------- Image does not exist ---------------");  
}  
};  
}
