Description

Change or get the index of the scene. The index used to define the superposition. By default, the first scene has index 0. If a scene is created at the same level, it will overlay the previous element and its index will be 1

Usage

Parameters

  • index {Integer|Scene} optional

    (optional) If the value is not specified, the current index of the scene is returned. If the value is negative, you change the index from the end. If the value is a scene, that scene is placed after the scene indicated

Returns

Integer|CanvasEngine.Scene

Example

var scene = canvas.Scene.call("Scene_Title");
scene.zIndex(0);

var scene = canvas.Scene.call("Scene_Title");
scene.zIndex(); // return current position
scene.zIndex(-1); // last position

var scene_title = canvas.Scene.get("Scene_Title"),
    scene_map = canvas.Scene.get("Scene_Map");
scene_map.zIndex(scene_title);

Discussion