Detecing Image Before Loading

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.


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?

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.parent = this;
imgLoadVars.onLoad = function(success) {
if (success) {
trace("-------- Image exist ---------------"+imageURL);
} else {
trace("-------- Image does not exist ---------------");