Loadmovie - Random variable not working!

The tutorial in The Best of Kirupa isn’t working for me!

When I try doing this:

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

I get a debug error:

Error opening URL “file:///C|/pathtofolder/flashdata.txt?reload=263757”

Where the reload variable is the random number and flashdata.txt is the file that contains the variable I need.

Please help! I hate cache!

I’ll have to think about that. I’ve never had that problem myself… but I usually don’t use that feature until I’m ready to upload the file to an online server…

ok, yes… that makes sense. You cannot use that when doing a test movie from inside Flash. Most of the time I’ll just comment out that loadVariable command with // then place a second loadVariable command just below it without the ?reload feature in it.
Then when I’m publishing for online usage I’ll delete that line and remove the comment tags from the first one.

WTH are you talking about??? :x 8o
I don’t understand a word…

There is no cache from the Flash program. You are not using a browser to view any of the files. So, you don’t need that random variable additive when doing tests from inside the Flash program. Only use it in a final production swf when you’re ready to upload that file to the internet.

I don’t think that I can say it more clearly than that. :slight_smile:

You mean that that random variable thing works only online???

yup… So just leave it out till your ready to upload.

Hmm… You think it’ll work on localhost?

I have Personal Web Server and I have the Inetpub/wwwroot folder and I have the http://localhost/ thing.

It might. I believe it will work in any situation where you are using a browser to view the swf or the html with the swf embeded in it, even if that’s local. It just doesn’t work in the Flash program test mode… as far as I know. I’ve never tried it that way.

Hey you were right, it works!