# How can I manipulate text fields?

**URL:** https://forum.kirupa.com/t/how-can-i-manipulate-text-fields/249338
**Category:** flash
**Created:** [January 17, 2008, 5:39pm UTC](https://forum.kirupa.com/t/how-can-i-manipulate-text-fields/249338 "2008-01-17T17:39:53Z")
**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 17, 2008, 5:39pm UTC](https://forum.kirupa.com/t/how-can-i-manipulate-text-fields/249338/1 "2008-01-17T17:39:53Z")

</div>

I am creating an xml slideshow off of the tutorial on this site and its working great. Im hung up on one thing though. I need to be able to manipulate text fields depending on which slide is being loaded, and im not sure how to do it.

here is my code:

var delay:Number = 5000;  
var init:Boolean = false;

// Load XML //  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
heading = [];  
body = [];  
total = xmlNode.childNodes.length;  
for (i = 0; i \< total; i++) {  
image\* = 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;

function fadeIn() {  
onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
loaded = picture.getBytesLoaded();  
if (loaded == filesize) {  
if (picture.\_alpha \< 100) {  
picture.\_alpha += 5;  
text\_mc.\_alpha += 5;  
} else {  
delete onEnterFrame;  
slideshow();  
}  
}  
};  
};

function fadeOut() {  
onEnterFrame = function() {  
if (picture.\_alpha \> 5) {  
picture.\_alpha -=5;  
text\_mc.\_alpha -= 5;  
} else {  
picture.\_alpha = 0;  
text\_mc.\_alpha = 0;  
delete onEnterFrame;  
nextImage();  
}  
};  
};

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

function firstImage() {  
init = true;  
picture.\_alpha = 0;  
text\_mc.\_alpha = 0;  
picture.loadMovie(image[0], 1);  
text\_mc.heading\_txt.text = heading[0];  
text\_mc.body\_txt.text = body[0];  
picture\_num();  
fadeIn();  
};

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) && !init) {  
p = 0;  
firstImage();  
} else if (p == (total - 1) && init) {  
p = -1;  
fadeOut();  
}else{  
fadeOut();  
}  
}  
};
