all groups > flash actionscript > april 2006 >
You're in the

flash actionscript

group:

loading variables problem



Re: loading variables problem Motion Maker
4/17/2006 10:54:24 PM
flash actionscript: if (photocount=="78"){


--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Does anyone have a simple script that will load a variable from a text file.
I
have tried LoadVars and loadVariables? I'm sure I must be doing something
wrong.

I can display the variable value in a dynamic text box, but if I try to use
the variable in an if statement, it doesn't work. If I trace the variable
value, there is nothing.

My text file, countphotos.txt, reads:
&photocount=78

An example of actionscript from this site that I tried is (I added the if
statement):

var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
if (success) {
if (photocount==78){
trace("photocount=" + photocount);
trace(this.toString());
}
} else {
trace("Error loading/parsing LoadVars.");
}
};
my_lv.load("countphotos.txt");


It traces nothing.
If I remove the if statement, but leave the trace statements, I get:
photocount=<p align="left"></p>
photocount=78&onLoad=%5Btype%20Function%5D

I also tried the if statement with quotes around 78.


Thanks for any help.
Howard

loading variables problem cd9
4/17/2006 11:40:23 PM
Does anyone have a simple script that will load a variable from a text file. I
have tried LoadVars and loadVariables? I'm sure I must be doing something wrong.

I can display the variable value in a dynamic text box, but if I try to use
the variable in an if statement, it doesn't work. If I trace the variable
value, there is nothing.

My text file, countphotos.txt, reads:
&photocount=78

An example of actionscript from this site that I tried is (I added the if
statement):

var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
if (success) {
if (photocount==78){
trace("photocount=" + photocount);
trace(this.toString());
}
} else {
trace("Error loading/parsing LoadVars.");
}
};
my_lv.load("countphotos.txt");


It traces nothing.
If I remove the if statement, but leave the trace statements, I get:
photocount=<p align="left"></p>
photocount=78&onLoad=%5Btype%20Function%5D

I also tried the if statement with quotes around 78.


Thanks for any help.
Howard
AddThis Social Bookmark Button