# loadVars image AND text not working

**URL:** https://forum.kirupa.com/t/loadvars-image-and-text-not-working/98191
**Category:** Uncategorized
**Created:** [January 4, 2004, 1:41pm UTC](https://forum.kirupa.com/t/loadvars-image-and-text-not-working/98191 "2004-01-04T13:41:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Fernandez](https://avatars.discourse-cdn.com/v4/letter/f/58f4c7/32.png) [@Fernandez](https://forum.kirupa.com/u/Fernandez)
#### Post date: [January 4, 2004, 1:41pm UTC](https://forum.kirupa.com/t/loadvars-image-and-text-not-working/98191/1 "2004-01-04T13:41:52Z")

</div>

Hello, I am fairly new to Flash and actionscripting. I have got a piece of code  
wich is only working the half way. I was wondering if somebody can help me  
out. This loadVars object just loads the text and not the images from a txt file.

It is important to do it this way because by clicking buttons it will need to load  
other txt files in de same mc.

Is this the proper way?

Thanx for anything  
**HOW I THINK IT SHOULD BE**

```auto

_root.mcnews.mcreports.index = 0;

reportVars = new LoadVars();
reportVars.onLoad = function(){
        if (_root.mcnews.mcreports.index>=0 && _root.mcnews.mcreports.index<_root.mcnews.mcreports.aantalimages) {
		_root.mcnews.mcreports.mc_info.play();
	}
		loadMovie(_root.mcnews.mcreports["image"+(_root.mcnews.mcreports.index)], _root.mcnews.mcreports.textHolder.imageHolder0);
		_root.mcnews.mcreports.textHolder.text_mc._text.text=this._text;
}
reportVars.load("reports/paris.txt");

stop();

```

**HOW IT WORKS BUT THIS IS NOT THE RIGHT WAY**  
This way it works but is not proper (CPU speed and the other textfiles cant be loaded):  
frame1

```auto
loadVariables("reports/paris.txt", _root.mcnews.mcreports.textHolder) ;

```

frame2

```auto
stop();
_root.mcnews.mcreports.Once = true;
_root.mcnews.mcreports.index = 0;
//
function haalVariables() {
        if (_root.mcnews.mcreports.index>=0 && _root.mcnews.mcreports.index<_root.mcnews.mcreports.aantalimages && _root.mcnews.mcreports.Once) {
                loadMovie(_root.mcnews.mcreports["image"+(_root.mcnews.mcreports.index)], _root.mcnews.mcreports.textHolder.imageHolder0);
                _root.mcnews.mcreports.mc_info.play();
                _root.mcnews.mcreports.Once = false;
        }
}

```

on the mc '‘textHolder’

```auto
onClipEvent (enterFrame) {
        _root.mcnews.mcreports.haalVariables();
}

```

on a preloader mc’ (in frame 1 of the root)

```auto
onClipEvent (enterFrame) {
        percentage = "LOADING "+Math.floor((_root.mcnews.mcreports.getBytesLoaded()/_root.mcnews.mcreports.getBytesTotal())*100)+"%";
        
        if ((_root.mcnews.mcreports.getBytesLoaded() == _root.mcnews.mcreports.getBytesTotal()) && geladen == "ja") {
                _root.mcnews.mcreports.gotoAndStop(2);
        } else {
                loadVariables("reports/paris.txt", _root.mcnews.mcreports.textHolder);
        }
}

```
