Exporting an Avatar
You can use the submitAvatar function to export a DisplayObject to be converted to a user avatar. It is highly recommended that avatars be at least 40x40px.
submitAvatar(avatar:DisplayObject, callback:Function):void
avatar:DisplayObject- Can be null, but highly recommended that you send yourself. If null, we will snapshot the stage.callback:Function- Function to call when content load request has been made
The callback function must accept a single Boolean 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();
rect.graphics.lineStyle(1);
rect.graphics.beginFill(0x0000FF, 1);
rect.graphics.drawRect(0, 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 :(")
}
}
Comments