URL: http://bcmoney-mobiletv.com/blog/2009/05/01/the-server-side-proxy/
ActionScript 3.0 for making a cross-domain HTTP request (which also requires use of a "crossdomain.xml" Flash security policy file)
crossdomain.xml resources: http://www.adobe.com/devnet/articles/crossdomainpolicyfile_spec.html
http://curtismorley.com/2007/09/01/flash-flex-tutorial-how-to-create-a-crossdomainxml-file/
http://stackoverflow.com/questions/101427/flex-and-crossdomain-xml
Flash/Flex to AJAX Bridge: http://www.ibm.com/developerworks/web/library/wa-aj-flex/
FlashXMLHttpRequest -- cross-domain requests: http://blog.monstuff.com/archives/000294.html
Cross-domain AJAX using Flash: http://blog.monstuff.com/archives/000280.html
flXHR -- VERY complete library for bridging Flash/AJAX and making cross-domain requests: http://flxhr.flensed.com
Other resources: http://www.securiteam.com/securityreviews/5KP0M1FJ5E.html
http://www.abdulqabiz.com/blog/archives/2006/03/03/http-authentication-for-httpget-requests-using-actionscript-3/
http://snipplr.com/view/5124/as3-sending-and-recieving-data-using-a-get-request/
http://stackoverflow.com/questions/702880/how-to-change-javascript-function-to-actionscript-3
http://www.switchonthecode.com/tutorials/using-a-php-proxy-with-flex-to-talk-cross-domain
package { import flash.display.*; import flash.events.*; import flash.utils.ByteArray; public class Proxy extends Sprite { [Embed(source="embeds/data.xml", mimeType="application/octet-stream")] private var BinaryData:Class; public function Proxy () { var byteArray:ByteArray = new BinaryData(); // Create a new instance of the embedded data var data:XML = new XML(byteArray.readUTFBytes(byteArray.length)); // Convert the data instance to XML trace(data.toXMLString()); // Display the source code for the embedded XML } var requestVars:URLVariables = new URLVariables(); requestVars.object_name = "ts"; requestVars.cache = new Date().getTime(); //prevent caching by using a timestamp var request:URLRequest = new URLRequest(); request.url = getParams("url"); //get the "url" parameter to set the HTTP request URL (path to data source) request.contentType = getParams("f"); //get the "f" parameter to set the MIME-type (format) request.type = getParams("e"); //get the "e" parameter to set the encoding type (i.e. UTF-8) request.method = URLRequestMethod.GET; request.data = requestVars; for (var prop:String in requestVars) { trace("Sent " + prop + " as: " + requestVars[prop]); } var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.TEXT; loader.addEventListener(Event.COMPLETE, loaderCompleteHandler); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); try { loader.load(request); } catch (error:Error) { trace("Unable to load URL"); } public function loaderCompleteHandler(e:Event):void { var variables:URLVariables = new URLVariables( e.target.data ); if(variables.success) { trace(variables.path); } } private function httpStatusHandler (e:Event):void { trace("httpStatusHandler:" + e); } private function securityErrorHandler (e:Event):void { trace("securityErrorHandler:" + e); } private function ioErrorHandler(e:Event):void { trace("ioErrorHandler: " + e); } public function getParams(documentRoot):Object { try { var params:Object = LoaderInfo(documentRoot.loaderInfo).parameters; var pairs:Object = {}; var key:String; for(key in params) { pairs.key = String(params.key); } } catch(e:Error) { return {}; } return params; } }
You need to login to post a comment.
