-
need help on loading vars from txt file
hi
is there any way i can make a var in a txt file such as a=1 and then get flash to use it
i need this for a website, i've tried and can't get it to work
thanks
-
FK'n_dog
use the LoadVars object
PHP Code:
lv = new LoadVars();
lv.load("test.txt"); // in txt file - &a=1&
lv.onLoad = function(){
str = lv.a; trace(str+" "+typeof str); // string - rec'd vars are strings
num = parseInt(lv.a); trace(num+" "+typeof num); // number
}
hth
-
thanks for the post but i don't understand
ive tried using :
if (a==1) {
}
and it won't work
ive made a gallery and the idea is if i put a=1 the gallery should load 1 pic
if a=2 load 2 pic and so on.
what should i do
thanks
-
FK'n_dog
lv.onLoad = function(){
a = parseInt(lv.a);
if(a==1){
// your code
}
}
-
thank you so much, it works perfectly
it's because i wasn't putting my if within the onload function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|