Connecting to a remote server through crossdomain.xml
Connecting to a remote server through a proxy
crossdomain.xml policy Flash Player can connect on any domain: <?xml version="1.0 "?> <!DOCTYPE cross-domain-policy SYSTEM ➥ "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy> <allow-access-from domain="*"/> </cross-domain-policy> restrict the connection to a particular site: <allow-access-from domain="www.site1.com"/> <allow-access-from domain="site2.com"/> secure server connection use secure="true“: <allow-access-from domain="www.site3.com" secure="true" />
crossdomain.xml policy continue Allow access to every server that ends with a certain name by using an asterisk (*) sign: <allow-access-from domain="*.yahoo.com" /> You can allow access to a specific IP address: <allow-access-from domain="66.500.0.20" /> Best way to find the cross domain policy: http://maps.yahoo.com/crossdomain.xml
RPC: HTTPService, WebService, and RemoteObject.
HTTPService example Rest used for web feeds ( Web syndication ) and is the most Common way to connect to Data sources. HTTPService restricted to GET & POST other methods like trace can be made with BlazeDS or Proxy.
for each (var property:XML in event.result.employees.employee)
E4X is preferred over regular XML when dealing with XML responses, since you can access the results easily and can perform expressions to filter the results. E4X is a language in its own right, and it has been incorporated into ActionScript 3.0. Many claim E4X to be a simple and easy way to access XML; however, it is not as easy as people make it out to be. To underscore this point, let’s take a look at E4X syntax. <employees> <employee> <name>John Do</name> <phone>212-222-2222</phone> <age>20</age> <email>email@example.com</email> </employee> </employees> var employeesList:XML = event.result as XML; var len:int = employeesList.employees.employee.length(); var results1:XMLList = employeesList.employees.employee; var results2:XMLList = employeesList.employees.child("*"); var results3:XMLList = employeesList.employees.*; var results4:XMLList = employeesList..employee; var filter1:XML = employeesList.employees.employee; var filter2:XMLList = employeesList.employees.employee. (phone == '212-333-3333'); var filter3:XMLList = employeesList.employees. *.(age >= 19 || age == 18);
Action Message Format (AMF) is a data format created by Macromedia with the release of Flash Player 6. AMF is now open source and part of BlazeDS, available to download here: http://opensource.adobe.com .
There are many types of AMF connections, but they all share the same basic principles of serializing (encoding) into a binary format and deserializing (decoding) once the data is returned to Flex.
Flash provides built-in AMF-based APIs such as the following:
RemoteObject: ActionScript 3.0 API that allows access to Java objects
Socket Connection: ActionScript 3.0 API that allows connection through sockets
NetConnection: API used to initiate commands on a remote server and play streaming video
open source and commercial AMF implementations that provide a gateway between the Flash Player and the implementation. Here are some of the popular ones:
Many XML web feeds have elements and attributes that are associated by a namespace. In order to be able to use namespaces, you will need to open the namespaces so you can access and use the elements and attributes on your feeds.
Many different namespace formats exist, and it would be difficult to cover all of them; however, once you master the principles, you will be able to handle any namespace that you come across.
SPARQL namespace - SPARQL is a query language for the Resource Definition Framework (RDF), and it is often used to express SQL queries across various data sources.
Atom namespace - Atom syndication format is an XML language that is used for web feeds, intended to improve RSS feeds. The primary usage of Atom feeds is syndication of different types of web content, such as that found on weblogs or news sites, to web sites or directly to users. To learn more, visit Atom’s official site: http://www.atomenabled.org .
GeoRSS namespace - GeoRSS is a lightweight format that is often used in existing feeds to map locations by adding basic geometries such as point, line, and box. To learn more about GeoRSS, visit its official site at http://georss.org/.