Javascript Utilities
The utility APIs are designed to assist Javascript programmers in
writing portable and robust code. By using these APIs, a developer can
load resources that normally require control over the HTML page. In
addition, the API automatically computes the proper location of these
resources even if they are not deployed in the same directory as the main.js
file.
GameUtils.include(path)
- Include another JS file after this one. Note that because this
function does not activate until after
the
e.g.
GameUtils.getImage(path, [dontCache]) - Get the actual path to an image (even on WiiCade!). The image is automatically cached unless the second parameter is "true". Note that you should always use this function for getting images, otherwise your code will not work on WiiCade.
e.g.
GameUtils.flushImageCache() - Dump any images that were already cached by the
GameUtils.includeStylesheet(path) - Include a rendering stylesheet.
e.g.
main.js file is processed, you cannot access
attributes of the other file until after the page is loaded.e.g.
GameUtils.include("includes/mylib.js");GameUtils.getImage(path, [dontCache]) - Get the actual path to an image (even on WiiCade!). The image is automatically cached unless the second parameter is "true". Note that you should always use this function for getting images, otherwise your code will not work on WiiCade.
e.g.
var image = new
Image(GameUtils.getImage("images/player.png"));GameUtils.flushImageCache() - Dump any images that were already cached by the
GameUtils.getImage()
function.GameUtils.includeStylesheet(path) - Include a rendering stylesheet.
e.g.
GameUtils.includeStylesheet("css/style.css");