Here i will provide a simple code, by which flash(client app) will communicate with server(php). Its very simple. Flash's 'URLLoader' class is enough. It is also used for this purpose along with other functionalities. here is the actionscript 3.0 code-
import flash.events.*;
import flash.net.*;
baseUrl = "http://yourdomain.com/";
datalLoader = new URLLoader();
serviceReq = baseUrl + "test.php";
dataLoader.addEventListener(Event.COMPLETE, getData);
dataLoader.load(new URLRequest(serviceReq));
function getData (arg1:flash.events.Event):*
{
trace("XMLData: " + arg1.target.data);
return;
}
here is is simple test.php
<?php
echo "response from server";
?>
after running the flash app, you will get the php response on the console window. just use this simple concept & make your flash app compatible with more useful functionalities like send mail, file read/write, connecting to database etc.
Subscribe to:
Post Comments (Atom)










0 comments:
Post a Comment