Here is an instance of using Flash AS3 to get remote PHP data, by obtaining data from the remote URL, and then displaying it in the Flash form text box, the instance code is as follows:
One, AS3 part [DOWNLOAD]
Package {
Import Flash.display.MovieClip;
Import flash.events.*;
Import flash.net.*;
Import flash.text.*;
public class Main extends MovieClip {
Public Function Main () {
var request:urlrequest = new URLRequest ("http://t.biuuu.com/index.php?nocache=");
Request.method = Urlrequestmethod.get;
var loader:urlloader = new URLLoader ();
Loader.dataformat = Urlloaderdataformat.variables;
Loader.addeventlistener (Event.complete, Completehandler);
Loader.load (Request);
function Completehandler (evt:event) {
B_title.text = Evt.target.data.username;
B_email.text = Evt.target.data.email;
}
}
}
}
The implementation steps are as follows:
One, get a URLRequest object instance
var request:urlrequest = new URLRequest (http://t.biuuu.com/index.php?nocache=);
Second, specify the method that the request object implements, such as get
Request.method = Urlrequestmethod.get;
Third, get a Urlloader object instance
var loader:urlloader = new URLLoader ();
Four, set the data format of the loader object
Loader.dataformat = Urlloaderdataformat.variables;
Five, set a listening event when getting PHP data complete
Loader.addeventlistener (Event.complete, Completehandler);
Six, load request
Loader.load (Request); The simple way is to explicitly request the properties of the URL, such as path address, request method, and then set the implementation of the return data, such as data format, processing methods, etc.
Second, the PHP section [path for http://t.biuuu.com/index.php This can be rooted in the actual situation to modify]
Note The assembly form of the data, similar to the parameter = value, if more than one parameter is used & Split
As an example above, we can implement a simple function of using flash AS3 to get PHP data remotely. With this knowledge, you can begin to implement a simple as3+php-based Web site.
Click to download: As3_php.rar
http://www.bkjia.com/PHPjc/364620.html www.bkjia.com true http://www.bkjia.com/PHPjc/364620.html techarticle Here is an instance of using Flash AS3 to get remote PHP data, by obtaining data from the remote URL and then displaying it in the Flash form text box, the instance code is as follows: one, AS3 section [download ...