Hi,
newbie here trying to learn flash by creating a website and kirupas been fantastic. However I’ve come across a problem. I followed the tutorial from here
but I have significantly more quotes in my txt file; just over 600. When I’d assigned them all numbers ["e300 etc] and set the number in the actionscript accordingly when I pressed the button sometimes a different quote appears and sometimes it comes up as “undefined”. I tried to go through the text file to see if I’d missed a delete or something but I couldn’t see anything.
I split it into sections of 100 quotes and ran it through to see if I could find which section the error was in - the first 100 seemed fine but undefined ckept popping up when I added the next hundred quotes. (I haven’t checked beyond that yet). I’ve looked through the file for this section but I can’t find the error.
Thing is all I’m looking for is that there are no spaces between the end of the quote and the next "e[number] bit and I haven’t numbered it twice. I don’t know what else would cause the ‘undefined’ error - though since the first hundred were fine I think the error lies within the text file itself. I dont know enough about this to know why this undefined thing keeps appearing though.
The text file is split into hundred sections - though in my actionscript I’m only accessing the first paragraph of the text file - this is just me trying to figure out where the problem lies and I dont think it’s related to the problem itself since my actionscript is only accessing the first paragraph anyway.
Thsi is he actionscript I’m currently applying and I’ve attatched the text file.
ranQuote = new LoadVars();
ranQuote.onLoad = function(success) {
if (success) {
RanNum = Math.ceil(Math.random()*299);
ran = this[“quote”+RanNum];
quote_txt.text = ran;
}
else {
quote_txt.text = “Sorry, the quotes appear to have been eaten by a giraffe, please try again later ^^”;
}
}
ranQuote.load(“quotes.txt”);
stop();
// quote scrolling
quotedown_btn.onPress = function() {
quote_txt.scroll += 1;
};
quoteup_btn.onPress = function() {
quote_txt.scroll -= 1;
};
I know that was quite a confusing explanation but if you can help me that would be fantastic, thanks