/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function create( className:String, value:Object ):void { var authorization:String = null; var request:URLRequest = null; var header:URLRequestHeader = null; authorization = Base64.encode( APPLICATION_ID + ":" + MASTER_KEY ); header = new URLRequestHeader( "Authorization", "Basic " + authorization ); request = new URLRequest( "https://api.parse.com/1/classes/" + className ); request.method = URLRequestMethod.POST; request.contentType = "application/json"; request.data = JSON.encode( value ); request.requestHeaders.push( header ); if( loader == null ) { loader = new URLLoader(); } loader.addEventListener( Event.COMPLETE, doCreateComplete ); loader.load( request ); }