Refreshing mc after writing to txt file


i have probably made a mistake, but i have been trying to find an explanation for this “problem” that i cannot find. I have a simple mc which loads in a textfile consisting of a header and body. After editing, the file is overwritten and saved. All this works fine, only problem is, as soon as the “save file” is finished, and i reload it using one of the buttons, it doesnt get refreshed with the new data. Im pretty new to all of this, so if i made newbie mistakes (which i undoubtly have) please be gentle :wink:

my flash movie has only 1 frame, the actionscript is on a separate layer.

var filePath = "php/";
var fileName:String;

// create 2 loadVars objects.

var load_data:LoadVars = new LoadVars();
var send_data:LoadVars = new LoadVars();

// define what should happen when the response is received,
// using 'this' to refer to dataIn and get data from it

send_data.onLoad = function() {
   if (this.valid=="1") {
      status_txt.text = "Data saved successfully!";
   } else {
      status_txt.text = "Data save error !";

// the function that will be called by the Save button 
function save_data():Void {
   load_data.header = header_txt.text;
   load_data.body = body_txt.text;
   load_data.filename = _root.fileName;
   trace (load_data);
   load_data.sendAndLoad("php/save_data.php", send_data, "POST");

function read_data():Void {

	var refresh_data:LoadVars = new LoadVars();
	refresh_data.load(filePath + fileName);
	refresh_data.onLoad = function(success) {
		if (success) {
			status_txt.text = "Loading done!";
			header_txt.htmlText = this.header;
			body_txt.htmlText = this.body;
		} else {
			status_txt.text = "Error Loading : " + fileName;

this.panel_L.btn_mc.btn_0.onRelease = function(){
	_root.fileName = "home.txt";
	_root.status_txt.text = "Loading : "+ fileName;

this.panel_L.btn_mc.btn_1.onRelease = function(){
	_root.fileName = "about.txt";
	_root.status_txt.text = "Loading : "+ fileName;
this.panel_L.btn_mc.edit_btn.onRelease = function(){
	_root.status_txt.text = "Editor Enabled";

this.panel_L.btn_mc.save_btn.onRelease = function(){
    _root.status_txt.text = "Sending data..."

this is the php file which saves the new data into the specified file :


//Capture data from $_POST array

$filename = $_POST['filename'];
$header_txt = $_POST['header'];
$body_txt = $_POST['body'];

$toSave ="header=$header_txt&body=$body_txt";

//Open a file in write mode

$fp = fopen($filename, "w");
if (@fwrite($fp, $toSave)) {
echo ("&valid=1&");
} else {
echo ("&valid=0&");

Any help is appreciated !

kind regards,