delay = 6000;
//-----------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;//listing_image
description* = xmlNode.childNodes*.childNodes[21].firstChild.nodeValue;
bed* = xmlNode.childNodes*.childNodes[9].firstChild.nodeValue;
bath* = xmlNode.childNodes*.childNodes[10].firstChild.nodeValue;
garages* = xmlNode.childNodes*.childNodes[11].firstChild.nodeValue;
price* = xmlNode.childNodes*.childNodes[12].firstChild.nodeValue;
address* = xmlNode.childNodes*.childNodes[5].firstChild.nodeValue;
city* = xmlNode.childNodes*.childNodes[6].firstChild.nodeValue;
_state* = xmlNode.childNodes*.childNodes[7].firstChild.nodeValue;
zip* = xmlNode.childNodes*.childNodes[8].firstChild.nodeValue;
agent_name* = xmlNode.childNodes*.childNodes[13].firstChild.nodeValue;
agent_address* = xmlNode.childNodes*.childNodes[14].firstChild.nodeValue;
agent_city* = xmlNode.childNodes*.childNodes[16].firstChild.nodeValue;
agent_state* = xmlNode.childNodes*.childNodes[17].firstChild.nodeValue;
agent_zip* = xmlNode.childNodes*.childNodes[18].firstChild.nodeValue;
agent_email* = xmlNode.childNodes*.childNodes[19].firstChild.nodeValue;
agent_image* = xmlNode.childNodes*.childNodes[21].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://www.prodigylistings.com/prodigy_featured.cfm");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = true;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
agent_image._alpha = 100;
agent_image.loadMovie(agent_image[p], 1);
desc_txt.text = description[p];
garages.text = garages[p];
bath.text = bath[p];
bed.text = bed[p];
zip.text = zip[p];
_state.text = _state[p];
city.text = city[p];
address.text = address[p];
price.text = price[p];
agent_name.text = agent_name[p];
agent_address.text = agent_address[p];
agent_city.text = agent_city[p];
agent_state.text = agent_state[p];
agent_zip.text = agent_zip[p];
agent_email.text = agent_email[p];
picture_num();
slideshow();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
agent_image._alpha = 100;
agent_image.loadMovie(agent_image[p], 1);
desc_txt.text = description[p];
garages.text = garages[p];
bath.text = bath[p];
bed.text = bed[p];
zip.text = zip[p];
_state.text = _state[p];
city.text = city[p];
address.text = address[p];
price.text = price[p];
agent_name.text = agent_name[p];
agent_address.text = agent_address[p];
agent_city.text = agent_city[p];
agent_state.text = agent_state[p];
agent_zip.text = agent_zip[p];
agent_email.text = agent_email[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
agent_image._alpha = 100;
agent_image.loadMovie(agent_image[p], 1);
desc_txt.text = description[p];
garages.text = garages[p];
bath.text = bath[p];
bed.text = bed[p];
zip.text = zip[p];
_state.text = _state[p];
city.text = city[p];
address.text = address[p];
price.text = price[p];
agent_name.text = agent_name[p];
agent_address.text = agent_address[p];
agent_city.text = agent_city[p];
agent_state.text = agent_state[p];
agent_zip.text = agent_zip[p];
agent_email.text = agent_email[p];
slideshow();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
WHen I test it, everything works great, except for the agent_images variable. i get this error in the output:
*** Security Sandbox Violation ***
Connection to file:///C|/Documents%20and%20Settings/jpb/Desktop/Flash/final/undefined halted - not permitted from http://www.mlsfinder.com/mn_rmls/_agent_images/460f29c4-7db9-4999-8da4-0769729cc976.jpg
– Remote SWFs may not access local files.
Is this something that’s in the xml, or is there a way to code around this in Flash 8?