Kongregate Developers

Requesting Item Definitions

The non-dynamic item definitions for a game can be retrieved using the requestItemList method. This function takes an array of tags to filter on (pass an empty array for all items), and a callback function to call when retrieval is complete.

requestItemList(tags:Array, callback:Function):void
  • tags:Array - An array of tags to filter the items on, can be empty.
  • callback:Function - The callback function

Result object passed to callback function:

  • success:Boolean - True if successful
  • data:Array - List of item instance Objects (if successful):
    • id:Number - Database ID of the item
    • identifier:String - Item identifier string
    • name:String - Item name
    • description:String - Item description
    • price:Number - Price of the item in Kreds
    • tags:Array - Tags for this item
    • image_url:String - Image for this item

Example: Request all items:

kongregate.mtx.requestItemList([], onItemList);

function onItemList(result:Object):void{
  trace("Item list result, success: " + result.success);
  if( result.success ){
    for( var i:int = 0; i < result.data.length; i++ ){
      var item:Object = result.data[i];
      trace((i+1) + ". " + item.identifier + ", " + item.id + "," + item.name);
    }
  }
}

Comments