Allow the player to browse shared content
browse(type, sort_order, label)
Browsing shared content
By using the browse
function on the sharedContent
property of the Kongregate API object, you can cause a list of shared content to appear in the user's browser. This will allow them to view, rate, or load shared content for your game. It accepts the following arguments:
Name | Type | Description |
---|---|---|
type | String | Type of content to browse |
sort_order | String | Optional parameter specifying how to sort the content |
label | String | Optional label to filter the content with |
The possible options for the sort_order
parameter are listed below:
Name | Description |
---|---|
by_own | List the content created by the player first |
by_newest | Newest content first |
by_load_count | Most frequently loaded content first |
by_friends | Content created by the player's friends first |
Example: Loading shared content with Contraption
as the content type
kongregate.sharedContent.addLoadListener("Contraption", onContraptionLoad);
function onContraptionLoad(params:Object):void {
var id:Number = params.id;
var name:String = params.name;
var permalink:String = params.permalink;
var content:String = params.content;
var label:String = params.label;
trace("Contraption " + id + " [" + label + "] loaded: " + content);
}
kongregate.sharedContent.addLoadListener("Contraption", onContraptionLoad);
function onContraptionLoad(params) {
var id = params.id;
var name = params.name;
var permalink = params.permalink;
var content = params.content;
var label = params.label;
console.log("Contraption " + id + " [" + label + "] loaded: " + content);
}
Example: Display a Shared Content browser for Contraptions
, only showing those by your friends with the "Level 3 Solution" label
kongregate.sharedContent.browse("Contraption", "by_friends", "Level 3 Solution");
kongregate.sharedContent.browse("Contraption", "by_friends", "Level 3 Solution");
Related: