Dynamic text scroll component update

I need to have a dynamic text box that loads text from an external file but I can’t get the scroll component to work.

I don’t need to use this script exactly but I can’t get my text box to update because once you have been there it has already been cached. I need it to be able to update quicker than one day but automatically update. I tried using enterFrame on a movie clip but then I can’t click on any of the other buttons for other external files.

now = new Date();
today = now.getDay();
days = [“sun”, “mon”, “tue”, “wed”, “thu”, “fri”, “sat”];
_root.loadedText.loadVariables(days[today]+".txt");

Is your question loading external text files using the Flash scroll component? If so, this question has been asked previously and I don’t think anyone has figured out a way to load external text files without making your own scroller from scratch.

As far as loading updated text after the text file as already been cached, all you need to do is apend a query string to the end of the text file’s name. That way, whenever the swf loads, the text file “appears” different than the file already cached. This is accomplished using the random number function. Consider this code:

rn = Math.round(Math.random()*1000000);
loadVariablesNum (“textfile.txt?reload=” +rn, 0);

I learned this from Server-Side Flash. I hope that answers your question. I was a little fuzzy on what exactly you were asking, but I took a stab at a solution.

I don’t understand. How would I use that in the code I already have? thanks

does anyone have any clues?
_root.brian.thank_you

Well, without thinking too much, I’d say

now = new Date(); 
today = now.getDay(); 
days = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
rn = Math.round(Math.random()*1000000); 
_root.loadedText.loadVariables(days[today]+".txt?reload=" +rn);

I don’t know about that relaod variable though.

pom :asian:

Error opening URL “file:///C|/WINDOWS/Desktop/flas/sun.txt?reload=319773”

I get errors like this every time.

No idea. Did it work before ? If so, it has to be that reload thing. I remember Upu, or David, as he likes to call himself now, writing about that a while ago on the previous forum. Maybe if he sees this…

pom :asian:

Do you have “sun.txt” stored in the same directory as the swf file?

yeah. it is in the same directory, but someone else helped me get the right code. So here is is:


now = new Date();
today = now.getDay();
days = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
loadedText.loadVariables(days[today]+".txt?rnd="+random(9999)); 

But I don’t understand what the “?” does (or the rest of it).

But now I have a new challenge. I am not able to put a scrollbar component on the text box. I named the instances right and wrote the variables right. It won’t even resize when I try to attach it to the text field even though the text field target and the text box instance are the same.

_root.brian.thank_you