{"_id":"571940bbc863120e00129f86","version":{"_id":"56abbf55f25f160d00e17f51","project":"56abbf55f25f160d00e17f4e","__v":12,"createdAt":"2016-01-29T19:36:53.665Z","releaseDate":"2016-01-29T19:36:53.665Z","categories":["56abbf56f25f160d00e17f52","56abca6bf9757e0d007c6650","56acddfa0ab3c00d00ce3332","56af65da9d32e30d0006d30f","56af66cab34d210d003d9ad0","56af6afcd21e9c0d00b628d1","56af6d6ecc4cbd0d00ce2c88","5705b12221cfed0e00e8c580","570a5676ade45d0e00c1ad33","570d7d25d1e4b82000d9e385","570eac3c3160d10e0041df0e","575709000fd6a3200010dded"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"570a5676ade45d0e00c1ad33","__v":0,"project":"56abbf55f25f160d00e17f4e","version":"56abbf55f25f160d00e17f51","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-04-10T13:34:46.864Z","from_sync":false,"order":3,"slug":"client-side-api","title":"Client Side API"},"parentDoc":null,"project":"56abbf55f25f160d00e17f4e","user":"56abbec30b9e0b0d00616274","__v":1,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-21T21:06:03.009Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":true,"order":21,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Maximum required game size\",\n  \"body\": \"Because a large percentage of our players play on laptops with relatively small screens, we request that games don't require any larger than a 1050x700 size if at all possible.\"\n}\n[/block]\n### Automatically resizing the enclosing iframe\n\nIf your game is embedded on Kongregate as an iframe you can take advantage of our auto-resizing feature. With this enabled the game's frame will automatically size to be appropriate for the player's browser. Your game will then need to match it's parent frame and you'll be good to go. \n\nTo use this feature, go to your game's `/edit` page (add `/edit` to the end of your URL) and scroll down until you see the dimensions section. Just set both your normal (minimum) and maximum dimensions and that's it! If you need to disable this later, set the maximum dimensions to blank again. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/8832539-2017-03-16_12-45-47.png\",\n        \"2017-03-16_12-45-47.png\",\n        914,\n        306,\n        \"#ebebeb\"\n      ],\n      \"sizing\": \"80\"\n    }\n  ]\n}\n[/block]\n### Manually resizing the enclosing iframe\n\nIf you need to manually resize your game's enclosing container, or you are not hosting your game through an iframe, you may do so with the `resizeGame call`. It accepts the following arguments:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`width`\",\n    \"0-1\": \"Integer\",\n    \"0-2\": \"Width of the frame in pixels\",\n    \"1-0\": \"`height`\",\n    \"1-1\": \"Integer\",\n    \"1-2\": \"Height of the frame in pixels\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nThe enclosing iframe will resize around your game. Games may not be resized smaller than their initial dimensions.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"kongregate.services.resizeGame(900, 650);\",\n      \"language\": \"javascript\",\n      \"name\": \"ActionScript 3\"\n    },\n    {\n      \"code\": \"kongregate.services.resizeGame(900, 650);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"Resizes the game frame\n`resizeGame(width,height)`","slug":"client-api-services-resizegame","type":"fn","title":"Services.ResizeGame"}

Services.ResizeGame

Resizes the game frame `resizeGame(width,height)`

[block:callout] { "type": "warning", "title": "Maximum required game size", "body": "Because a large percentage of our players play on laptops with relatively small screens, we request that games don't require any larger than a 1050x700 size if at all possible." } [/block] ### Automatically resizing the enclosing iframe If your game is embedded on Kongregate as an iframe you can take advantage of our auto-resizing feature. With this enabled the game's frame will automatically size to be appropriate for the player's browser. Your game will then need to match it's parent frame and you'll be good to go. To use this feature, go to your game's `/edit` page (add `/edit` to the end of your URL) and scroll down until you see the dimensions section. Just set both your normal (minimum) and maximum dimensions and that's it! If you need to disable this later, set the maximum dimensions to blank again. [block:image] { "images": [ { "image": [ "https://files.readme.io/8832539-2017-03-16_12-45-47.png", "2017-03-16_12-45-47.png", 914, 306, "#ebebeb" ], "sizing": "80" } ] } [/block] ### Manually resizing the enclosing iframe If you need to manually resize your game's enclosing container, or you are not hosting your game through an iframe, you may do so with the `resizeGame call`. It accepts the following arguments: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "`width`", "0-1": "Integer", "0-2": "Width of the frame in pixels", "1-0": "`height`", "1-1": "Integer", "1-2": "Height of the frame in pixels" }, "cols": 3, "rows": 2 } [/block] The enclosing iframe will resize around your game. Games may not be resized smaller than their initial dimensions. [block:code] { "codes": [ { "code": "kongregate.services.resizeGame(900, 650);", "language": "javascript", "name": "ActionScript 3" }, { "code": "kongregate.services.resizeGame(900, 650);", "language": "javascript" } ] } [/block]