# "loadVariables" Problem loading variable from .txt

**URL:** <https://forum.kirupa.com/t/loadvariables-problem-loading-variable-from-txt/275338>\
**Category:** flash\
**Created:** [November 12, 2008, 6:04pm UTC](https://forum.kirupa.com/t/loadvariables-problem-loading-variable-from-txt/275338 "2008-11-12T18:04:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lacohido](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@lacohido](https://forum.kirupa.com/u/lacohido)\
**Post date:** [November 12, 2008, 6:04pm UTC](https://forum.kirupa.com/t/loadvariables-problem-loading-variable-from-txt/275338/1 "2008-11-12T18:04:02Z")

</div>

Hello all-

Heres my problem. I have a “sliding photo slideshow” which hinges on this variable -

```auto
thumbNum = 10;

```

This variable specifies the number of photos in the slideshow

I want to have this variable in an external .txt file so I can update the number of photos without having to reexport the flash file

I figured it would look like this  
.txt file:

```auto
num = 10

```

flash:

```auto
loadVariables("thumbnum.txt","");
thumbNum = num;

```

I thought this would work, but it doesnt. I know that the .txt file is loaded, but when I trace the “num” variable, it says its undefined. If anyone can help I would be very thankful!

Here is a larger portion of my Flash actionscript if you need to see more

```auto

thumbNum = 47;
total = (thumbNum * 200)-800;
wholeNum = Math.floor(total/600); 
wholeSteps = wholeNum * 600;
remainder= total - wholeSteps;

trace (total);
trace (wholeNum);
trace (wholeSteps);
trace (remainder);

b1._visible = false;
final_x=0;
speed = 8;

if(thumbNum <= 4){
	b1._visible = false;
	b2._visible = false;
	photo_mc._x = 0;
}
else{ photo_mc.onEnterFrame = function() {
	photo_mc._x += (final_x - photo_mc._x)/speed;
	
}

}
b2.onRelease = function() {
	if(final_x==0){b1._visible = true;}
	if(total!=wholeSteps) {
		if(final_x==-wholeSteps){b2._visible = false;}
	}
	else{if(final_x==-wholeSteps + 600){b2._visible = false;}}
	
	if(remainder!=0){
		if(final_x==-wholeSteps){final_x = final_x - remainder;}
		else{final_x = final_x - 600;}
	}
	else{final_x = final_x - 600;}
}

b1.onRelease = function() {
	if(final_x==-600){b1._visible = false;}
	if(final_x==-total){b2._visible = true;}
	
	if(remainder!=0){
		if(final_x==-total){final_x = final_x + remainder;}
		else{final_x = final_x + 600;}
	}
	else{final_x = final_x + 600;}
}

stop();

```

You can also see an example of the slideshow at [DaraLevinePhoto.com/countries/australia](http://www.daralevinephoto.com/country/australia/)
