# Help Newbie - loadVariables is working only in my pc :(

**URL:** https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039
**Category:** flash
**Created:** [October 27, 2003, 11:26am UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039 "2003-10-27T11:26:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Alegria](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Alegria](https://forum.kirupa.com/u/Alegria)
#### Post date: [October 27, 2003, 11:26am UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039/1 "2003-10-27T11:26:45Z")

</div>

Hi

I’m newbie in AS Flash (and new in this foro) and I have 3 swf.  
Principal is the first one that loads pliego and this one load textos.

I have 3 files txt’s and 3 files jpg’s by now (\_global.tope=2) and  
All is OK while I’m testing on my pc.

When I’m testing on my site, the Dynamic Text doesn’t load txt files!  
The size of biggest file txt are 5 KB

What are going wrong?

Thanks for help me

Alegria

p.d.: attached is script of the 3 fla’s

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 27, 2003, 11:48am UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039/2 "2003-10-27T11:48:54Z")

</div>

Let me write that down here, so we can read it:

```auto

// Principal INDEX.swf
stop();
// LAS VARIABLES GLOBALES ESAS
_global.num = 0;
_global.tope = 2;
_global.str = "plitn";
// LA COSA DE LOS CARACTERES
System.UseCodepage = true;
ponerboton(0);
// CREO UN MC VACIO PARA USARLO EN POSTERIORES CARGAS
this.createEmptyMovieClip("container", 10);
// PARA EL BOTON PLIEGO
bot_pliego.onRelease = function() {
	//_root.uno._alpha = 30;
	container._x = 25;
	container._y = 25;
	//container._x = 40;
	//container._y = 155;
	ponerboton(1);
	container.loadMovie("pliego.swf");
};
// PARA EL BOTON INICIAR
iniciar.onRelease = function() {
	container.unloadMovie();
	//_root.uno._alpha = 100;
	ponerboton(0);
	this.loadMovie("index.swf");
};
// FUNCION PARA INHABILITAR BOTONES NO USADOS
function ponerboton(estadoboton) {
	_root.iniciar._visible = estadoboton;
	_root.bot_pliego._visible = !estadoboton;
}

-----------------------------------------
// Secundario PLIEGO.swf
// Este swf será cargado dinámicamente según sea el destino elegido
// La variable str será asignada fuera de este swf, por ahora lo dejo aquí
// CREO UN MC VACIO PARA USARLO EN POSTERIORES CARGAS
stop();
this.createEmptyMovieClip("contiene", 20);
_global.num = 0;

cargarr();
boton_dcha.onRelease = function() {
	if (_global.num<tope) {
		_global.num += 1;
		cargarr();
	} else {
		_global.num = tope;
	}
};
boton_izda.onRelease = function() {
	if (_global.num>0) {
		_global.num -= 1;
		cargarr();
	} else {
		_global.num = 0;
	}
};
function cargarr() {
	this.createEmptyMovieClip("mv1", 0);
	mv1.createEmptyMovieClip("mv1b", 1);
	mv1.mv1b.loadMovie(_global.str+_global.num+".jpg");
	mv1.onEnterFrame = function() {
		if (mv1._width>0) {
			mv1._width = 140;
			mv1._height = 95;
			mv1._x = 5;
			mv1._y = 5;
			delete mv1.onEnterFrame;
		}
	};
	// CARGAMOS EL TITULO
	this.loadVariables(_global.str+_global.num+".txt");
	if (titulo<>undefined) {
		presentitulo.text = titulo;
		delete this.onEnterFrame;
	}
	// CARGAMOS TEXTOS
	contiene._x = 30;
	contiene._y = 145;
	contiene.loadMovie("textos.swf");
}

---------------------------------------------------------------
// Secundario TEXTOS.swf

stop();
this.createEmptyMovieClip("cargador", 0);
this.loadVariables(_global.str+_global.num+".txt");
barra.setStyleProperty("arrow", 0x039603);
barra.setStyleProperty("highlight3D", 0xF20104);
barra.setStyleProperty("highlight", 0xF20104);
barra.setStyleProperty("face", 0xF20104);
cargador.onEnterFrame = function() {
	if (variable<>undefined) {
		cajatexto.text = variable;
		delete this.onEnterFrame;
	}
};

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 27, 2003, 11:57am UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039/3 "2003-10-27T11:57:23Z")

</div>

I haven’t looked at the rest of the code, only the loadVariables part. Are you sure the path to your textfile is correct ? Because it might work offline because the path offline is correct, but online it has to be correct too. Also, I suggest you use the loadVars object instead of loadVariables:

```auto

lv = new loadVars();
lv.onLoad = function(){
for(all in this){
trace(this[all])
}
// Use this.message for example to target a variable from the textfile
}
lv.load("http://www.server.com/file.txt");

```

\*Welcome to the forum by the way 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 27, 2003, 2:05pm UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039/4 "2003-10-27T14:05:17Z")

</div>

Grateful 🙂

After fight with the code a while, I have this an still only works  
on my pc…

Also I’m looking at some method to get if load has finished, and  
then continue

// set variable to get load, the path is relative so I think is OK ??  
var arctexto = \_global.str+\_global.num+".txt";  
loadText = new loadVars();  
loadText.load(arctexto);  
trace(arctexto)  
loadText.onLoad = function(success) {  
if (success) {  
// trace(success);  
presentitulo.html = true;  
presentitulo.htmlText = this.titulo;  
}  
};

could you give a trick about “get if loaded really”?  
thanks a lot 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 27, 2003, 2:52pm UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039/5 "2003-10-27T14:52:27Z")

</div>

To see if it’s loaded, you can check if loadText.getBytesTotal() is not zero. Try changing your relative path to an absolute path, so not folder/file.txt, but [http://www.server.com/folder/file.txt](http://www.server.com/folder/file.txt)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 27, 2003, 3:26pm UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039/6 "2003-10-27T15:26:01Z")

</div>

Don’t ask me why, but now is working OK 😮  
Only I have done now are:

1- Delete all files in my web site  
2- Upload again  
3- Before Run, close all FLA ¿?

again, thanks

— ActionScript working finally :))  
function LeeTexto() {  
// ESTA VARIABLE INDICA EL ARCHIVO A SEGUIR Y ES RUTA RELATIVA  
arctexto = \_global.str+\_global.num+".txt";  
// CREAMOS UN OBJETO LOADVARS  
loadText = new loadVars();  
// MIRAMOS SI HAY CARGA CORRECTA, SI ES ASI; ASIGNAMOS LAS VARIABLES  
// REQUERIDAS, INCLUSO LA GLOBAL QUE SE USA EN TEXTOS.SWF  
loadText.onLoad = function(success) {  
if (success) {  
// trace(success);  
presentitulo.html = true;  
presentitulo.htmlText = this.titulo;  
\_global.relato = this.variable;  
}  
};  
// CARGAMOS EL ARCHIVO DE TEXTO  
loadText.load(arctexto);  
}

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 27, 2003, 3:38pm UTC](https://forum.kirupa.com/t/help-newbie-loadvariables-is-working-only-in-my-pc/34039/7 "2003-10-27T15:38:20Z")

</div>

Probably the absolute path 😉
