Flash accepting and sending variables

How can I make Flash accept a numerical variable from a webpage and send the variable back to a webpage? Something like a counter, which counts the number of times the Flash is loaded.

I want Flash to read a numerical value maybe from a txt file(any other ways?), add 1 to it, and send it back to a PHP script.

Welcome to the fourms. Search for this topic it’s been asked MANY times here before.

essentially you’d be using :


//to send only
sendVars = new LoadVars();
sendVars.myValue = "this is what my var is";
sendVars.send("myphppage.php","POST");
//to load vars from php
sendVars = new LoadVars();
getVars.onLoad = function(){
trace(this.myValue);
}
getVars.load("myPHPpage.php");
//combining the two into one function
sendVars = new LoadVars();
getVars = new LoadVars();
sendVars.myValue = "this is what my var is";
getVars.onLoad = function(){
trace(this.myValue);
}
sendVars.sendAndLoad("myphppage.php",getVars,"POST");

Sorry I’m kindda new to Actionscript, and can’t test it myself as I don’t do PHP. Will the following work? I’m using Flash to load a variable, add 1 to it, and send the variable to another page.
Btw, what does trace(something) do?

[AS]

getVars = new LoadVars();
getVars.onLoad = function(){
trace(this.counter);
}
getVars.load(“myPHPpage1.php”);

getVars += 1;

getVars.send(“myPHPpage2.php”, “POST”);

[/AS]