Ask the user to change their avatar
submitAvatar(display_object, callback)

Exporting a custom avatar

Kongregate's Avatar Export API gives you the ability to export in-game avatars and let users use them as their Kongregate profile avatar. When you call the submitAvatar function, the user will receive a notification that the game is requesting to change their avatar. At that point, they'll be able to crop the suggested image if they wish, and can choose to accept or decline the avatar modification. This functionality can be used to provide bonuses for players, as well as more directly with avatar creator/editor apps, and probably other uses we haven't even thought of yet.

You can use the submitAvatar function on the images property of the Kongregate API object to export a DisplayObject or a Base64-encoded string containing the image data to be converted to a user avatar. It is highly recommended that avatars be at least 40x40px:

display_objectDisplayObject or Base64-encoded stringThe DisplayObject or Base64-encoded string containing the avatar image
callbackFunctionThe callback function to be called when the operation is complete.

The callback function is passed a single boolean parameter which will be true if the user has accepted the avatar and false if they decide not to use it.

Example: Exporting a rectangle

var rect:Shape = new Shape();;, 1);, 0, 75, 50);

kongregate.images.submitAvatar(rect, onAvatarComplete);

function onAvatarComplete(success:Boolean) {
  if(success) {
    trace("That user must love rectangles!")
  } else {
    trace("Next time I'll try a triangle :(")

kongregate.images.submitAvatar(base64PNG, function(success) {
	if (success) {
  	console.log('That is a small avatar');