temp_image(0)=LoadImage("images/def2.bmp")<----crashes
This is because your application is looking for the image in the wrong place. Specificly it's looking for it in the directory (folder) where your map is, because that's the "current folder".[Edit]You can use SystemProperty("appdir") to get the proper location.
myImage = LoadImage(SystemProperty("appdir")+filename$)