Class Index | File Index

Classes


Class Stage

The Stage function creates a new Stage and returns it.
Defined in: Stage.js.

// creates an empty stage.
var stage1 = Stage({
   width: 100, height: 100,
   container_id: "stage_example_1"
});
// Loading an additional Scene.
var scene1 = Scene({
   content: [ Graphic({ x: 24, y: 24, url: "./images/ball.png" }) ]
});

var scene2 = Scene({
   content: [ Graphic({ x: 24, y: 20, url: "./images/beetleship.png" }) ]
});

var stage2 = Stage({
   width: 100, height: 100,
   container_id: "stage_example_2",
   scene: scene1
});
stage2.unload();
stage2.setScene(scene2);
stage2.load();
Class Summary
Constructor Attributes Constructor Name and Description
 
Stage(_details)
Method Summary
Method Attributes Method Name and Description
 
This function creates the canvas element under the container element.
 
This function finds the container element from the Document.
 
This function returns the name of this Stage.
 
This function returns the current scene of the Stage.
 
Returns the size of this Stage.
 
Checks to see if the scene is running.
 
load()
This function loads this Stage, creating it's canvas and then calling loadScene with the current Scene if there is one.
 
loadScene(_scene)
This function loads the given Scene into the Stage.
 
setScene(_scene)
Sets the scene for this stage.
 
Stops the funLoop from running and clears the FPS update.
Class Detail
Stage(_details)
Parameters:
{Object} _details
A JSON object with the following properties:
Property Required Default
bg_color no #EFEFEF
container_id yes
height yes
name no ""
scene no Scene({name: "empty", content: []})
update_time no 1
width yes
Method Detail
createCanvas()
This function creates the canvas element under the container element. It uses the findContainer function to find the container, and uses document.creatElement to create the canvas element.

findContainer()
This function finds the container element from the Document. This implementation uses document.getElementById to find the container element.

getName()
This function returns the name of this Stage.

getScene()
This function returns the current scene of the Stage.

getSize()
Returns the size of this Stage.

isRunning()
Checks to see if the scene is running.
Returns:
true if the scene is running.

load()
This function loads this Stage, creating it's canvas and then calling loadScene with the current Scene if there is one.

loadScene(_scene)
This function loads the given Scene into the Stage. It calls the load function of the given scene with an instance of this Stage.
Parameters:
_scene
- The Scene to load into this Stage.

setScene(_scene)
Sets the scene for this stage.
Parameters:
_scene

unload()
Stops the funLoop from running and clears the FPS update.

Documentation generated by JsDoc Toolkit 2.3.0 on Fri Oct 30 2009 09:09:10 GMT-0700 (PDT)