Greetings,
I am working on a flash/PHP image viewer that automatically determines how many jpgs are in a specific file directory, and then loads each file into the flash movie. I have gotten that part of the project to work just fine, however the problem arises when I turn each of the newly loaded images into “buttons” and try loading a specific URL when theyre clicked. Here is my AS code thus far:
function fillPicsArray(ok)
{
if (ok)
{
var _loc2 = 0;
do
{
pics.push(this["f" + _loc2]);
} while (this["f" + ++_loc2] != undefined)
loadPic();
}
else
{
trace ("problem with the script");
} // end else if
} // End of the function
function onLoadInit(pic)
{
pic._width = 117;
pic._height = 176;
pic._x = 8 + 166 * ipic;
pic._y = 10;
pic._alpha = 100;
if (++ipic < pics.length)
{
loadPic();
} // end if
} // End of the function
function loadPic()
{
holder.createEmptyMovieClip("p" + ipic, ipic);
holder["p" + ipic]._alpha = 0;
mcl.loadClip("../path_to_pics/" + pics[ipic], holder["p" + ipic]);
} // End of the function
function init()
{
lv.onLoad = fillPicsArray;
lv.load("../directory/readfromdir.php");
mcl = new MovieClipLoader();
mcl.addListener(this);
ipic = 0;
ifarleft = 0;
this.createEmptyMovieClip("holder", 1);
} // End of the function
var lv = new LoadVars();
var pics = [];
var mcl;
var ipic;
init();
holder.onRelease = function(){
// open a new window with the correct directory and file name of the image selected
getURL(get the selected pic's directory & file name, "_blank");
}
When the image is clicked, I would like it to load a new browser window with a URL something like this: “domain.com/images/pic_I_selected.jpg”
Im sure its something stupid, but I just cant figure out why I cant pull the file name from the “pics” array. (if thats where I should be pulling the file name from???)
Thank you in advance!
Kind Regards,