Create an Object on Parse


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public function create( className:String, value:Object ):void
  2. {
  3. var authorization:String = null;
  4. var request:URLRequest = null;
  5. var header:URLRequestHeader = null;
  6.  
  7. authorization = Base64.encode( APPLICATION_ID + ":" + MASTER_KEY );
  8. header = new URLRequestHeader( "Authorization", "Basic " + authorization );
  9.  
  10. request = new URLRequest( "https://api.parse.com/1/classes/" + className );
  11. request.method = URLRequestMethod.POST;
  12. request.contentType = "application/json";
  13. request.data = JSON.encode( value );
  14. request.requestHeaders.push( header );
  15.  
  16. if( loader == null )
  17. {
  18. loader = new URLLoader();
  19. }
  20.  
  21. loader.addEventListener( Event.COMPLETE, doCreateComplete );
  22. loader.load( request );
  23. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.