Reseting the dynamic jpgs and check on error

hey guy need help again.
i have this on my button :
on(release){

this._parent.loadImages(this._parent,this._parent.text1.text);
}
this will load the image that is key in the text field.
any idea i can check an error here like:
if i key in the wrong file name i will get a text say “wrong file name.!”
else if correct file name, load the jpgs…

i have this on my reset button:
on(release){
this._parent.text1.text= “”;

}
it will reset wht i wrote on the text field.
but i still need to unload all the pics i have uploaded.

any ideas???
thanks…