Hi
I have been able to get this code to work!:
on (release) {
var time = getTimer();
for (var i = 0; i<1000; i++) {
var j = i;
}
_root.mb.onRelease = function() {
/* Contact PHP File /
SendVars = new LoadVars();
targetObject = new LoadVars();
SendVars.SendData = _root.text1writer.text;
SendVars.allowSend = true;
SendVars.myFile = “CreateMe.txt”;
targetObject.onLoad = function(success:Boolean) {
if (success) {
/ Success /
trace(“Successfully received notification from the PHP File.”);
} else {
/ Failure */
trace(“Failed to receive notification from the PHP File.”);
}
};
SendVars.sendAndLoad(“http://localhost//.php?uniqueID=” + getTimer(), targetObject, “POST”);
};
The PHP script looks like this!:
<?php
$myFile = $_POST[‘myFile’];
$allowSend = $_POST[‘allowSend’];
$SendData = $_POST[‘SendData’];
if ($allowSend == true){
$fh = fopen($myFile, ‘w’) or die(“can’t open file”);
fwrite($fh, $SendData);
fclose($fh);
echo “result=success”;
}
?>
The result when i push the button named mb is that the text that was written in the text1writer textarea gets printed into the the textfile named CreateMe.
So far so god. But what I am really looking to do is this:
I want the value of a variable to be printed in the textfile (or even better in a mySQL database). The variable value I want to post is from the varable:
var time = getTimer();
so the value should be a number.
So my question is. How do I change the code to make this happen?
I am guessing that SendVars.SendData = _root.text1writer.text; should be replaced with something else, but what?
I noticed that there is the codes: value an valueOf. Is this something I can use?
How wrong is this?: SendVars.SendData = time_var.valueOf;