Skip to content

cristobal/AS3HTTPService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

AS3 HTTPService
Description:
	Mimics the mx.rpc.http.HTTPService class for AS3 Applications.
	By using the flash.net.URLLoader & flash.net.URLRequest classes.

Example:
	import com.net.http.HTTPService;
	import com.net.rpc.events.ResultEvent;
	import com.net.rpc.events.FaultEvent;
	
	/**
	 * Complete handler
	 */
	function handleComplete(result:ResultEvent):void {
	  trace("Successfully loaded xml:");
	  trace(event.result);
	}

	/**
	 * Fault handler
	 */
	function handleFault(event:FaultEvent):void {
	  trace("Could not load xml");
	  trace(event.fault);
	}
	
	/* Initialize and set parameters*/
	var url:String = 'http://example.com/destination';
	var httpService:HTTPService = new HTTPService();
	httpService.resultFormat = HTTPService.RESULT_FORMAT_XML;
	
	/* Add Event listeners */
	httpService.addEventListener(ResultEvent.RESULT, handleComplete);
	httpService.addEventListener(FaultEvent.Fault, handleFault);
	
	/*  Send the request */
	httpService.send({"key": "value"});

About

HTTPService for AS3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published