# How to check if file exsists

**URL:** <https://forum.kirupa.com/t/how-to-check-if-file-exsists/180561>\
**Category:** flash\
**Created:** [March 1, 2006, 3:06pm UTC](https://forum.kirupa.com/t/how-to-check-if-file-exsists/180561 "2006-03-01T15:06:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gotland](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@gotland](https://forum.kirupa.com/u/gotland)\
**Post date:** [March 1, 2006, 3:06pm UTC](https://forum.kirupa.com/t/how-to-check-if-file-exsists/180561/1 "2006-03-01T15:06:25Z")

</div>

Is the onLoad function the only way to find out if a file exist or not. As for now. I’m looping through a xml file. if image exist i add the filepath to an array if not, i ignore it. But if i check the filepath with onLoad. All the images in the xml file are loaded. I dont want to load the files yet.

var fileFound:Boolean = new Boolean();  
var fileExists = new LoadVars();  
fileExists.onLoad = function (success)  
{  
if (success)  
{  
fileFound = true;  
}  
else  
{  
fileFound = false;  
}  
};

fileExists.load(“file.jpg”);
