# Problem loading dynamic text & image

**URL:** <https://forum.kirupa.com/t/problem-loading-dynamic-text-image/132810>\
**Category:** Uncategorized\
**Created:** [January 2, 2005, 4:51am UTC](https://forum.kirupa.com/t/problem-loading-dynamic-text-image/132810 "2005-01-02T04:51:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alwaysdrifting](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@alwaysdrifting](https://forum.kirupa.com/u/alwaysdrifting)\
**Post date:** [January 2, 2005, 4:51am UTC](https://forum.kirupa.com/t/problem-loading-dynamic-text-image/132810/1 "2005-01-02T04:51:31Z")

</div>

My problem is I can’t get the image and dynamic text (using typewriter effect) to work simultaneously. I can get either one to work but not both. My fla file explains it better than I can. The below code to get the text node from the XML file appears within the preload image function. **If the line in red ([COLOR=Red]TextEffect(location);[/COLOR]) is commented out, the image loads. If the line is left in, the text loads.**

I hope someone can help, Thank you.

```auto
//Load XML data
ImageLocation = new XML();
ImageLocation.ignoreWhite = true;
timeline = this;
// Function to load text when xml is done loading:
ImageLocation.onLoad = function(){
	portfolioTag = this.firstChild;
//LocationNode is set to zero the first text node is called	
location = portfolioTag.childNodes[LocationNode].attributes.LOCATION;
	[COLOR=Red]**TextEffect(location);**[/COLOR]
	}
ImageLocation.load("location.xml");

```

This function is called to acheive the text effect:

```auto
function TextEffect(location){
		myText="";
this.onEnterFrame = function() {
		description.text = myText.substr(0, type);
        type += 3;
        myText = location;
};	
type = 0;
}

```

**Xml File (location.xml)**

```auto
<?xml version="1.0" encoding="ISO-8859-1"?><random>
		<file title="chicago" location="the sears tower, chicago" image="images/c9.jpg"/>
		<file title="bangkok" location="victory monument, bangkok" image="images/b20.jpg"/>
		
</random>

```
