Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : Simple text data load failing


SamInLosAngeles
4/28/2004 8:39:23 PM
This is the first time I have tried using external data and I'm having trouble
loading data from a text file. My code is as follows:

var alarmData = new LoadVars();
alarmData.load("file:///c:/alarm.txt")
alarm_hour = alarmData.hour;
alarm_minutes = alarmData.minutes;

The text file contains one simple line:
hour=11&minutes=10

The file is found but when I try and access the data I get and "undefined"
error.

Can anyone point out the error? Your help is appreciated.
Shades Dallas
4/29/2004 3:03:19 AM
You need to wait for the data to actually load, like this:

[b]
var alarmData=new LoadVars();
alarmData.onLoad=function() {
alarm_hour=alarmData.hour);
alarm_minutes=alarmData.minutes);
}
alarmData.load("file:///c:/alarm.txt")
[/b]

/Shades
AddThis Social Bookmark Button