Could someone please explain to me why my array is not working? imgurl[]; is an array that is used in the menu function, but it seems that the variable i cannot be recognized outside the CreateMenu function… how come? I see it being done in the xml photo gallery for example… what am I doing wrong?
(hope you don’t mind the php colors… i find it easier to read this way)
var item_spacing = 25;
var item_count = 0;
var img = [];
var imgfldr = [];
var imgurl = [];
var work_id = [];
var menulist = [];
var i = 0;
function CreateMenu() {
//below: the condition that makes the repetition of going through all works
works = portfolio_xml.firstChild.firstChild.childNodes;
for (i=0; i<works.length; i++) {
//MENU LOOP
if (works*.parentNode.attributes.cup == "UrbDes") {
var title = works*.firstChild.firstChild;
menulist* = menu.attachMovie("projects_list", "item"+i, i);
menulist*._y = i*item_spacing;
menulist*.project_name.text = title;
var images = works*.childNodes[1].childNodes;
var imgtotal = images.length;
var q = 0;
img[q] = q+1;
work_id* = portfolio_xml.firstChild.firstChild.childNodes*;
imgfldr[q] = work_id*.childNodes[1].attributes.puc;
imgurl* = "images/"+imgfldr+"/image"+img+".jpg";
}
trace (imgurl[0]);
//HERE IS MY PROBLEM.
menulist*.onRelease = function() {
imageholder.loadMovie(imgurl*, 1);
}
}
//end of condition of going through all works
}
//end of condition of generating the portfolio
function firstImage() {
imageholder.loadMovie(imgurl[0], 1);
// desctop.text = desc[0];
}
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success) {
if (success) {
CreateMenu();
} else {
trace("Error loading XML file");
}
};
portfolio_xml.load("portfolio.xml");
Please help!
Akilah