Dynamic images from Database

This is my new project, I have a database contain information about products and there images, I also created a flash file, with 4 scenes:
1st scene has the product categories on rollover list of sub categories appears and each sub category link to 2nd scene
2nd scene has the product sub categories and links to 3rd scene
3rd scene has products displayed horizontally as images and underneath the image the product name, and each product links to 4th scene
4th scene displays details about selected product from scene # 3.

All the information is driven from a database using ASP and here is a list of the challenges that I got:

1- Scene # 3 loading images into the movie dynamically, I had no problem loading the information as text and display them in a horizontal line, the following is the script that I used:

// depth
depth = -1;
// hide the original clips which called dynpic
dynpic._visible = 0;
// split up the array by looking for the commas from the information which loaded in a previous frame through the asp file
dynpic_array = collectprodpic.split(",");
// get the length of the array
dynpic_length = dynpic_array.length;
// set the start y position (x position depends on where you put it on the screen)
xposition = 275;
// looping everything
for (i=0; i<dynpic_length; i++) {
// duplicate the movie
duplicateMovieClip(dynpic, “dynpic” add i, depth);
// set the movie postion
setProperty(“dynpic” add i, _y, xposition);
// loading the image to the movie
// Set the x position plus 55
xposition = xposition+55;

of course I know that I have to load all the images first and then display them and that’s one of the things that I’m stock on.
One other thing when generating those images I need to generate a link associated with that picture so when I click on that picture it passes the id of that product to scene # 4 and then I can take from there by pulling the information from the database and display it again.

Any help, please