Random image script, currently jpg format, need to be either png or gif extensions

I have applied a script that was on one of the threads posted by Waztone, that I have tried to get hold of, but unsuccessful at my attempt so maybe someone else can help me.

The script in question is as follows:

[script]

img = Math.floor(Math.random()*5);
loadMovie(“img/”+img+".jpg", “container_mc”);

[/script]

I attempted to use this for some random png images or gif images and it did not work as expected and yes I changed the extention etc and still no joy. I did not have any errors returned except no images were displayed in png or gif format.

Do you have any idea how I can achieve the different formats using this script. I tried the following.

[script]

img = Math.floor(Math.random()*5);
loadMovie(“img/”+img+".png", “container_mc”);

[/script]

If anyone has any ideas for adapting this to different extension types I would be greatful, thanks in advance.