# Is there any reason why an if statement will interupt a xml connection?

**URL:** https://forum.kirupa.com/t/is-there-any-reason-why-an-if-statement-will-interupt-a-xml-connection/249220
**Category:** flash
**Created:** [January 16, 2008, 5:13pm UTC](https://forum.kirupa.com/t/is-there-any-reason-why-an-if-statement-will-interupt-a-xml-connection/249220 "2008-01-16T17:13:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![goetzs](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@goetzs](https://forum.kirupa.com/u/goetzs)
#### Post date: [January 16, 2008, 5:13pm UTC](https://forum.kirupa.com/t/is-there-any-reason-why-an-if-statement-will-interupt-a-xml-connection/249220/1 "2008-01-16T17:13:58Z")

</div>

I am working on a small flash slideshow using xml from a tutorial on this site, and it works great except for the text fields need to be moved and resized each slide. So I created an if statement to do so depending on which slide is showing, but the minute I put the if statement in the actionscript the xml data doesnt seem to come through anymore. Any Suggestions?

This is my code:

// Slide duration (milliseconds) //  
delay = 10000;

//-----------------------//  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
slide = [];  
heading = [];  
body = [];  
total = xmlNode.childNodes.length;  
for (i = 0; i \< total; i++) {  
slide\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
heading\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
body\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;  
}  
firstImage();  
} else {  
content = “XML not loaded!”;  
}  
}

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“slides.xml”);  
p = 0;

this.onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
loaded = picture.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded == filesize) {  
if (picture.\_alpha \< 100) {  
picture.\_alpha += 7;  
heading\_txt.\_alpha += 7;  
body\_txt.\_alpha += 7;  
}  
}  
};

function nextImage() {  
if (p \< (total - 1)) {  
p++;  
if (loaded == filesize) {  
picture.\_alpha = 0;  
heading\_txt.\_alpha = 0;  
body\_txt.\_alpha = 0;  
picture.loadMovie(slide[p], 1);  
heading\_txt.text = heading[p];  
body\_txt.text = body[p];  
slideshow();  
}  
}  
}

function firstImage() {  
if (loaded == filesize) {  
picture.\_alpha = 0;  
heading\_txt.\_alpha = 0;  
body\_txt.\_alpha = 0;  
picture.loadMovie(slide[0], 1);  
heading\_txt.text = heading[0];  
body\_txt.text = body[0];  
slideshow();  
}  
}

function slideshow() {  
myInterval = setInterval(pause\_slideshow, delay);  
function pause\_slideshow() {  
clearInterval(myInterval);  
if (p == (total - 1)) {  
p = 0;  
firstImage();  
} else {  
nextImage();  
}  
}  
}

// Manipulate text fields according to slides //  
/_if(picture = “slides/slide\_01.jpg”){  
heading\_txt.\_x = 89;  
heading\_txt.\_y = 157;  
heading\_txt.\_width = 493;  
body\_txt.\_x = 89;  
body\_txt.\_y = 203;  
body\_txt.\_width = 435;  
body\_txt.\_height = 215;  
}_/
