Kongregate Developers

Displaying canvas text

You can display text on the canvas with the displayCanvasText function. It takes name, text, position, and an options object, which may contain any of the fields in an AS3 TextFormat object.

  • name:String - Name of the text object
  • text:String - The text to display
  • pos:Object - The position object, as described above
  • options:Object - Any fields from an AS3 TextFormat object

Example: Display the text "Testing123" at 0,0 using the "Verdana" font at size 12.

var position:Object = {x:0,y:0};
var options:Object = {font:"Verdana",size:12,color:0x7FB7FF};
kongregate.chat.displayCanvastext("Text", "Testing123", position, options);