View Full Version : setting variable to loadVariablesNum
flyrod
02-08-2001, 04:47 PM
hi - i'm having a little trouble with this. i am trying to set a variable that will be used in a loadVariablesNum statement.
the code:
onClipEvent (enterFrame) {
noteMonth = _root.calendarHold.calendar.checkMonth;
noteDay = _root.calendarHold.calendar.checkDay;
yesterday = noteDay-1;
yesterdayNoteName = noteMonth+" "+yesterday+" "+"Notes";
loadVariablesNum (noteMonth+"/"+"notes"+"/"+yesterday+".txt", 0);
}
the error:
Error opening URL "file:///notes/-1.txt" <-- this here
when i check the variable in a txt box, it comes up as it should (in this case '7')
tah!
jake88
02-08-2001, 05:57 PM
Now I'm not an expert on flash but perhaps take out the "/" because unless the txt file is in the root directory it should not be there. either that, or give it an absoulute path like c:\notes\1.txt. I've also noticed that you have -1.txt is that the actual name of the file?
flyrod
02-08-2001, 06:04 PM
i'm using the "/" as a literal string to define the path to the .txt file.
the '-1.txt' is the problem i am having. the path to the .txt file should be :
February/notes/7.txt
as you can see, that is what i am trying to achieve with this statement:
noteMonth+"/"+"notes"+"/"+yesterday+".txt"
where:
'noteMonth" = February dir
'"notes"' = notes dir
'yesterday' = noteDay (which, in this case, is 8) -1
'".txt"' = the file extention
but thanks anyway.
Jesse
02-09-2001, 03:14 AM
No, the orriginal scrip is your problem.
None of your variable have any values, which is why you're not getting the right output. Either that or the paths to your variables are wrong.
The fact that you get -1 means that 'noteDate' has no value no value is equivalent to 0)
yesterday = noteDay-1;
= 0 - 1
= -1.
Also your month isn't comming out because it's no inserting February into the string.
Test Mode your movie (Ctrl Enter in flash) then user Ctrl Alt V to view your variables. If they have values, then copy and paste the paths to them and use absolute paths fo safety.
Finally, change the last line of code to:
loadVariablesNum (noteMonth+"/notes/"+yesterday+".txt", 0);
(That's just mroe efficient.)
Cheers
Jesse
flyrod
02-09-2001, 02:45 PM
thanks jesse - it's working, i guess, but i'm still getting the error:
Movie Clip: Target="_level0.notePadYesterday"
Variable _level0.notePadYesterday.name = "notePadYesterday"
Variable _level0.notePadYesterday.noteMonth = "February"
Variable _level0.notePadYesterday.noteDay = 9
Variable _level0.notePadYesterday.yesterday = 8
Variable _level0.notePadYesterday.yesterdayNoteName = "February 8 Notes"
Error opening URL "file:///notes/-1.txt"
as you can see, yesterday does = 8 (today is the 9th), but the app is still looking for ///notes/-1.txt
the clip loads with the correct info in the text box, i must have that coded somwhere else in the movie.
Jesse
02-10-2001, 12:12 AM
When all else fails use absolute paths:
loadVariablesNum (_level0.notePadYesterday:noteMonth+"/"+"notes"+"/"+_level0.notePadYesterday:yesterday+".txt", 0);
See if that works.
Cheers
Jesse
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.