Changed JavaScript API name for signal connection and disconnection
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / docs / content / stage.js
1 /**
2 ## Stage API
3
4 The Stage is a top-level object used for displaying a tree of Actors.
5
6  - Stage is a static object used by accessing the dali.stage object.
7  - Stage provides a top-level "root" actor.
8  - Stage provides Key Events to the application
9  - Stage has a background color you can set, see  {{#crossLink "stage/setBackgroundColor:method"}}{{/crossLink}}
10   
11 When an actor is not required, remove it from the stage to save memory and help performance.
12 ```
13 dali.stage.setBackgroundColor( dali.COLOR_WHITE);
14   
15 var stageSize = dali.stage.getSize();
16   
17 var actor = new dali.Actor( );
18   
19 dali.stage.add( actor );
20   
21 // when the actor is no longer required
22 dali.stage.remove( actor );
23 ```
24
25 ![ ](../assets/img/stage.png)
26
27
28 ### Key Events
29
30 Key events are received through the keyEvent callback.
31
32 ```
33 daliApp.myCallback = function (keyEvent)
34 {
35   switch (keyEvent.keyDescription) {
36           case "Up": log("up");
37               break;
38   
39           case "Down": log("down");
40               break;
41   
42           case "Left": log("left");
43               break;
44   
45           case "Right": log("right");
46               break;
47   
48   }
49 }
50
51 dali.stage.on("keyEvent", daliApp.myCallback);
52 ```
53
54 The key event object has the following properties
55 ```
56   KeyEvent = {
57     state,             // boolean  = "down" or "up" key state
58     shiftPressed,      // boolean, shift key is held
59     ctrlPressed,       // boolean, ctrl key is held
60     altPressed,        // boolean, alt key is held
61     keyModifiers,      // key modifiers
62     keyCode,           // key code
63     keyDescription,    // key description
64     timestamp          // The time in milli-seconds when the event occured
65   }
66 ```
67  @class Stage
68 */