View Full Version : dynamic texts and temporary internet files
kylaar
02-27-2005, 02:32 AM
hi,
I have a problem with flash, and it would be great if I knew how to fix it.
I have a .swf file that updates according to a text file. So when you change the text file it changes there. Except now it doesn't change unless you go and delete the Temporary Internet Files, because it saves the file stuff.txt into the temporary internet files.
How can I make it that it looks and see's if there is a new file instead of showing that one?
I can post my .fla doc here if you want to have a look.
Also, you can see the .swf here: http://home.graffiti.net/styrofoam:graffiti.net/website/home.htm
Hi,
One method is to use a preview link when you update the textfile. If your using a backend scripting language like PHP, when you process the information to be saved to the textfile, provide a link to the updated textfile. When you open the textfile after updateing, it will update your browser cache. Then when you load the movie, the current textfile contents will be cached instead of the previous contents of the textfile.
NTD
kylaar
02-28-2005, 04:00 AM
thanks that could work, but i'm not using PHP or anything.
Hi,
If your just using dynamic text without a backend script, instead of updating your browser cache, you can make sure the text file being used is he latest copy with something like this......
d = new Date();
// always a unique number
kill = d.getTime();
myTarget="http://somesite.com/yourText.txt?kill="+kill);
myVars = new LoadVars();
myVars.load(myTarget);
myVars.onLoad = function(success) {
if (!success) {
trace("failed to load");
} else {
do something
}
}
kylaar
02-28-2005, 05:55 AM
my current script is:
loadVarsText = new loadVars();
loadVarsText.load("http://home.graffiti.net/styrofoam:graffiti.net/website/newsedit.txt");
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (success) {
scroller.text = this.var1;
} else {
trace("not loaded");
}
};
what do I change it to? do I replace all of it to what is above?
when I replace it all, it says:
Scene=Scene 1, Layer=actions, Frame=1: Line 5: ';' expected
myTarget="http://home.graffiti.net/styrofoam:graffiti.net/website/newsedit.txt?kill="+kill);
If you want the fla file I'm using, it is:
http://home.graffiti.net/styrofoam:graffiti.net/website/fla/newsedit.fla
Hi,
Try....
d = new Date();
// always a unique number
kill = d.getTime();
myTarget="http://home.graffiti.net/styrofoam:graffiti.net/website/newsedit.txt?kill="+kill);
loadVarsText = new loadVars();
loadVarsText.load(myTarget);
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (!success) {
trace("failed to load");
} else {
scroller.text = this.var1;
}
}
kylaar
02-28-2005, 07:29 AM
Scene=Scene 1, Layer=actions, Frame=1: Line 4: ';' expected
myTarget="http://home.graffiti.net/styrofoam:graffiti.net/website/newsedit.txt?kill="+kill);
sorry. Maybe I'm doing something wrong =(
Hi,
There was an extra paren at the end of the myTarget variable. I did not test the code. Try this instead.....
d = new Date();
// always a unique number
kill = d.getTime();
myTarget = "http://home.graffiti.net/styrofoam:graffiti.net/website/newsedit.txt?kill="+kill;
loadVarsText = new loadVars();
loadVarsText.load(myTarget);
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (!success) {
trace("failed to load");
} else {
scroller.text = this.var1;
}
};
kylaar
03-01-2005, 09:07 AM
thanks, that seemed to work =) Thanks for all your help.
Powered by vBulletin™ Version 4.1.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.