Read an Object from Parse


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



Copy this code and paste it in your HTML
  1. public function read( className:String, objectId:String ):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 + "/" + objectId );
  11. request.method = URLRequestMethod.GET;
  12. request.contentType = "application/json";
  13. request.requestHeaders.push( header );
  14.  
  15. if( loader == null )
  16. {
  17. loader = new URLLoader();
  18. }
  19.  
  20. loader.addEventListener( Event.COMPLETE, doReadComplete );
  21. loader.load( request );
  22. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.