Get the remote PHP data instance _php tutorial using Flash AS3

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.