PHP Gallery

I have a PHP Photo Gallery Script that loads images from a flat file into an html document does anyone know how I can do this in flash I have searched all over the net on how to load images dynamically using php basically what I would like is to be able to animate the images a bit display them 5 per row 4 rows have next previous buttons click on it displays a larger image and be able to go back to where you were last

I have attached the PHP Script if you want to take a look

Cheers

and thank you so much if you help me out