layer_get_id_at_depth


描述

You can use this function to get the IDs of all layers assigned a specific depth. You give the depth to check and the function will return an array with 1 or more entries depending on whether there are any layers at the given depth or not. If there are no layers at the given depth then the array will have a single entry at the [0] position with a value of -1, but, if there are layers at the depth, then an entry will be made in the array for each layer found - the entry value will be the unique ID value for a layer.


语法:

layer_get_id_at_depth(depth)


参数:

参数 描述
depth The depth to check and retrieve the layer IDs from.


返回:

Array


例如:

var a = layer_get_id_at_depth(0);
if a[0] != -1
    {
    for (var i = 0; i < array_length_1d(a); i++;)
        {
        layer_destroy(a[i]);
        }
    }

The above code retrieves data about the layers with a depth of 0. A check is done to see if any layers exist at that depth, and if there are then the returned array is parsed and each of the found layers is destroyed.


上一页: General Layer Functions
next: layer_get_name
© Copyright YoYo Games Ltd. 2018 All Rights Reserved