I'm gonna cry: reading variables from line in textfile

I thought it would be quite easy to read variables from a textfile into flash, where the first line is the first variable, the second line is the second variable and so on.

I was wrong.

I already asked help in several ways but no go :crying: so I thought I might ask you, the specialists

Let me explain:

In a textfile, there are 7 lines:


&mondaystr=this is the menu for monday&
&tuesdaystr=this is the menu for tuesday&
&wednesdaystr=this is the menu for wednesday&
&thursdaystr=this is the menu for thursday&
&fridaystr=this is the menu for friday&
&saturdaystr=this is the menu for saturday&
&sundaystr=on sunday we rest&

So now I want to read those variables into flash. I use this code:


loadedText = loadVariablesNum("file.txt", 0);
var Menutoday = mondaystr;
var Menutomorrow = tuesdaystr;
var dayToday = dateToday.getDay();

Depending on the day it is, the Menutoday string and the Menutomorrow string should be calculated using a switch case thing.

Now, what’s the situation:

when I create a textfield with var mondaystr, it works. Also for the other days.
when I create a textfield with var Menutoday, it says undefined?!

I don’t get it. It’s two days now that I’m working on this single issue and I’m afraid I’m completely stuck :sen:

Can someone help me out please?

Thanks in advance.

EDIT: maybe I should add the switch code too?



switch (dayToday) {
	case 0: Menutoday = sundaystr; 
			Menutomorrow = mondaystr;
			break;
	case 1: Menutoday = mondaystr;
			Menutomorrow = tuesdaystr;
			break;
	case 2: Menutoday = String(tuesdaystr);
			Menutomorrow = wednesdaystr;
			break;
	case 3: mealOfTheDay = tuesdaystr;
			Menutomorrow = wednesdaystr;
			break;
	case 4: Menutoday = tuesdaystr;
			Menutomorrow = wednesdaystr;
			break;
	case 5: Menutoday = tuesdaystr;
			Menutomorrow = wednesdaystr;
			break;
	case 6: Menutoday = tuesdaystr;
			Menutomorrow = wednesdaystr;
			break;
		}

why not try xml ? it is a perfect solution to this situation

although you can do with text file too… but xml is definitely fitting in :slight_smile:

no not xml its an abbreviation!!! :stuck_out_tongue: