Reorder z order of layer

Step1. Get layer
var layer = inst.layer;
or
var layer = (typeof layerparam == "number")?
            this.runtime.getLayerByNumber(layerparam):
            this.runtime.getLayerByName(layerparam);


Step2. Sort the list layer.instances
layer.instances(SORTFN);
for example
function sortInstanceByZIndex(a, b)
{

    return a.zindex - b.zindex;
}

Step3. reassign zindex of instances in this layer.
layer.zindices_stale = true;


Reference

No comments:

Post a Comment