Hi! I have been playing around with the tutorial “Loading Text from External Sources” by Chris99022. The project I am working on is a real estate site and I am wanting to display data in a dynamic text box about each lot when they are clicked on. I want to be able to update the information via txt file.
First I modified his code to pull all the variables from 1 txt file. It would defeat my purpose to have 100 different txt files on the server that you have to go through. So now each button pulls 1 variable from the same txt file.
Question 1: How can I modify the code to pull multiple variables into the txt area when one button is pushed. For example, when lot 1 is clicked, it would pull in a variable with the lot name, a variable with the description, and a variable with the sold/not sold status. Here is the current code pulling one variable:
on (release) {
loadText = new loadVars();
loadText.load("text1.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
newsBox.html = true;
newsBox.htmlText = this.myNews;
}
};
}
Question 2: I thought about just using a naming convention in the txt file like this:
1number=Lot 1
&1desc=blah,blah,blah
&1status=sold
&2number=Lot 2
&2desc=blah,blah,bleep
&2status=
etc… but I was wondering if there was a way to do something like this (I know the code won’t work but just the hierarchy):
Lot1
number=Lot 1
desc=blah,blah,blah
status=sold
End Lot1
Lot2
number=Lot 2
desc=blah,blah,blah
status=
End Lot2
If there is not a way to use hierarchy in a txt file or xml then I could just use line returns in the txt file to separate sections and is their a way to REM out lines in the text file that could be descriptive to the user but ignored by Flash?
Question 3: Is there a way to dynamically load jpg’s with a text file where a variable is the path to the jpg on the server and it would load into the texxt area with the other variables?
Thanks,
Scott Whitehead