Kongregate Developers

Displaying canvas images

You can load an image from an external source into the canvas by using the displayCanvasImage function. It takes a name, url, and position object:

  • name:String - Name of the image object
  • url:String - URL of the image to load
  • pos:Object - A position object, as described above

Example: Load an image and display it at 100,100 on the canvas

var url:String = "http://www.fake.com/picture.jpg";
var position:Object = {x:100,y:100};
kongregate.chat.displayCanvasImage("Image", url, position);