The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 Viewshow do I get flash to display information from a text file?
f
website :: hugostonge.com
my job :: we+are
I did this:
onEnterFrame = function() {
mydata = load("http://localhost/game.txt")
trace(mydata);
}
but something's not working for some reason
f
At 6/23/07 04:35 PM, Spectacle wrote: I did this:
onEnterFrame = function() {
mydata = load("http://localhost/game.txt")
trace(mydata);
}
but something's not working for some reason
oh and the output is "undefined" and in the text file is just numbers.
f
There is no 'load' function. To read a file you need to use the LoadVars.onData event.
ok I've fixed that now, but it doesn't seem to do that well
the output comes out as "201%2E25%2C219%2E25=" and this is what's in the text file "201.25,219.25"
is there a way to display it exactly as it is in the text file? this is the script now:
mydata = new LoadVars();
onEnterFrame = function() {
mydata.load("http://localhost/game.txt")
trace(mydata);
}
f
At 6/23/07 05:22 PM, GustTheASGuy wrote: Again, onData.
onData is basically used to check when the data has finished loading from a source or when there is an error downloading from a source.
onData isn't required for the information to be recieved. I've recieved the information the only problem now is that it converts the full stops and commas into something else.
f
var mydata = new LoadVars();
mydata.onData = function (data) {
trace (data);
};
Give me a break.
At 6/23/07 06:16 PM, GustTheASGuy wrote: var mydata = new LoadVars();
mydata.onData = function (data) {
trace (data);
};
Give me a break.
I can't see how that would work at all.
f
Then you probably have no idea what onData is/does, look it up. Did you even try what he said?
AS: Main
Don't read this sentence.
At 6/23/07 10:35 PM, Spectacle wrote: I can't see how that would work at all.
thats because youre a bratty kid who refuses to accept help from knowledgable people.
var lv:LoadVars = new LoadVars();
lv.onData = function():Void{
for (var i:String in this) trace(i + ": " + this[i]);
};
lv.sendAndLoad('/path/to/text/file.txt', lv);
At 6/23/07 11:42 PM, authorblues wrote:At 6/23/07 10:35 PM, Spectacle wrote: I can't see how that would work at all.thats because youre a bratty kid who refuses to accept help from knowledgable people.
yeah, you're right I was actually just being stupid and moody. I was getting annoyed the flash wasn't working and it turns out that the script he gave me did work and I had just made a mistake.
Sorry to GustTheASGuy for getting annoyed and thanks for the help.
f
what's the difference between putting the load part this way round:
mydata.load("http://localhost/conv.txt")
mydata.onData = function (data) {
//script
}
and putting it this way round:
mydata.onData = function (data) {
//script
}
mydata.load("http://localhost/conv.txt")
f