Load | Data is similar to an HTML page, which is a window used to capture and display information. However, the SWF file can remain loaded in the browser while continuing to update with new information without reloading the entire page. You can use action script functions and methods to send information to server-side scripts, text files, and XML files, or to receive information from them.
In addition, the server-side script can request specific information from the database and then transfer it to the SWF file. You can compose server-side scripts in a variety of languages: the most commonly used are CFML, Perl, ASP (Microsoft Active Server Pages), and PHP. By storing and retrieving information from the database.
Many action script functions and methods can be used to pass information to the SWF file and to outgoing information from the SWF file. Each function or method uses a protocol to transmit information and requires that the information be formatted in a certain way.
Flash documents can load data from external sources using one of the following data load calls: Xml.load (), Xml.sendandload (), Loadvars.load (), Loadvars.sendandload (), Loadvariables (), Loadvariablesnum (), Movieclip.loadvariables (), Xmlsocket.connect (), and Macromedia Flash Remoting ( netservices.creategatewayconnection).
In addition, the SWF file can import resources defined in a Run-time shared library or another SWF file at run time. By default, data or SWF media (the Run-time shared library) must reside in the same domain as the SWF that loads the external data or media.
To make the data and resources in the Run-time shared library available to SWF files in other domains, you can use Cross-domain policy files. A cross-domain policy file is an XML file.
When a flash document attempts to access data in another domain, Flash Player automatically attempts to load the policy file from that domain. If the field that contains the Flash document that you are trying to access data is included in the policy file, the data will automatically become accessible data.
The policy file must have a name crossdomain.xml and reside in the root directory of the server that provides the data. Policy files only work on servers that communicate through HTTP, HTTPS, or FTP. The policy file is specific to the port and protocol of the server on which it resides.
If you specify an IP address, access is granted only to SWF files loaded with IP syntax from that IP address (for example, http://65.57.83.12/flashmovie.swf), but not to those SWF files loaded with the domain name syntax. Flash Player does not perform DNS resolution.
The following is an example of a policy file that, assuming that the policy file is on scile.com, can access the data on the 105.216.0.40 from the Flash documents on Foo.com, friendoffoo.com, *.foo.com, and scile.com:
<xmp>&lt;?xml version= "1.0"?&gt;&lt;cross-domain-policy&gt; &lt;allow-access-from domain= "www.friendOfFoo.com"/ &gt; &lt;allow-access-from domain= "*.foo.com"/&gt; &lt;allow-access-from domain= "105.216.0.40"/&gt;&lt;/ Cross-domain-policy&gt;</xmp>
This makes it easy for flash to send and load external data. For the sending and loading of the data we typically use the loadvars.sendandload () in the Loadvars class, The Xml.sendandload () in the XML class, and the Macromedia Flash Remoting, which Remoting It requires additional software support, so it is more common to use Loadvars classes and XML classes, and of course remoting has its own advantages.
The Loadvars.sendandload () in the Loadvars class is appropriate for sending and receiving a small amount of simple data, while the Xml.sendandload () in the XML class is appropriate for sending and receiving large amounts of complex data. With the full Dynamic Web site that allows Flash to make interactive databases.
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.