I want to integrate my flash file with php code. I got the below code from
http://www.kirupa.com/developer/actionscript/flashphpxml_integration2.htm
function lv(l, n, t, e, f) {
if (l == undefined) {
l = new LoadVars();
l.onLoad = function () {
var i;
n.htmlText = "";
if (t == undefined) {
n.htmlText += "<b>" + this["title" + e] + "</b><br>";
} else {
for (i = 0; i < this.n; i++) {
n.htmlText += "<a href='" + this["link" + i] + "'>" + this["title" + i] + "</a><br>";
}
}
};
}
l.load(f);
}
lv(sites_txt, "cycle", null, "sites.php");
I did all the steps given in that forum but while running that code i got error Like
1180: Call to a possibly undefined method LoadVars.
Warning: 1060: Migration issue: The method LoadVars is no longer supported. For more information, see the URLVariables class, the URLRequest.urlVariables and URLRequest.postData properties, and the URLLoader.dataFormat property..
1136: Incorrect number of arguments. Expected 5.
I am new to the flash scripting please guide me how to troublshooting these
Your example code was in AS2, here’s how you send and receive data from and to PHP using AS3 using:
Here’s a quick class I have made for you:
With this, you can send data to a given PHP script in the format of
URLVariables.URLVariablesare easily prepared like so:Here’s a quick example I have mocked up for you which sends a string to PHP, then PHP sends back the string hashed as MD5 and also has a timestamp attached as a secondary value.
Your output for this will be something similar to:
Just alter the
_completemethod in thePHPDataclass to handle your response data as required 🙂I’ll throw this in because your question has the mysql tag..
All you need to do is your standard INSERT and SELECT queries in the PHP script and encode your result into this format:
So you could have..