# Problems reloading with LoadVars from text file into flash 8 movie

**URL:** https://forum.kirupa.com/t/problems-reloading-with-loadvars-from-text-file-into-flash-8-movie/218272
**Category:** flash
**Created:** [March 6, 2007, 10:35am UTC](https://forum.kirupa.com/t/problems-reloading-with-loadvars-from-text-file-into-flash-8-movie/218272 "2007-03-06T10:35:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ptrok](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@ptrok](https://forum.kirupa.com/u/ptrok)
#### Post date: [March 6, 2007, 10:35am UTC](https://forum.kirupa.com/t/problems-reloading-with-loadvars-from-text-file-into-flash-8-movie/218272/1 "2007-03-06T10:35:38Z")

</div>

I want to parse different variables to a flash movie header each time a different page is loaded… So I created a test movie that will loadvars from a text file which is created/modified by a php script on each page where the flash file resides.

it works ok for the first page but each time I navigate to the next … the datafile is changed with approptiate variables but the flash movie does not update … perhaps I am trying to do this wrong way … is there some way to ensure that flash reloads with LoadVars correctly?

Heres the an example of my php script in each page

```php
 
//php script to pass php variable values to a text data file
$var= "var1" ;
$swf_file = "c1.swf";  
$dataFile = "data4flash.txt";// name of data file
//open/create a text file called "data4flash"
$fh = fopen($dataFile , 'w') or die("can't open file");
$pass2flash ="var=" . $var. "&" . "file=" .$swf_file;// data in URLEncoded, name-value pair format
fwrite($fh, $pass2flash); //write to data file - overwrite previous data
fclose($fh);

```

On each page there is a flash movie that just contains a button and two dynamic text fields which I use to display the contents of the text file created by php above

```auto
 
mybtn.onRelease = function () {
varsfromtxt = new LoadVars();
varsfromtxt.load(http://localhost/TESTER/data4flash.txt);
varsfromtxt.onLoad = function() {
//LoadVars values into text boxes
_root.myVar= varsfromtxt.myVar; 
_root.myfilename= varsfromtxt.myfilename;
}}

```

… I assumed that on each page load the flash would reload and retreive the updated data when called by my button event.

Appreciate any suggestions from the more knowledgable.  
:beam:  
Cheers

Paul
