Layers Class
A class Layers represents a named collection of display objects container (layers). It is the base class of all display objects that act as a container for other objects.
Single level layers inheritance:
Constructor
Layers
()
Example:
// Create three layers, that can be getted by layers.top, layers.middle, layers.bottom
var layers = new LINK.Layers("bottom", "middle", "top");
layers.top.addChild(...);
layers.bottom.addChild(...);
Multi level layers inheritance (be careful with swapping between different levels of layers):
var layers = new LINK.Layers({
"ground": new LINK.Layers("earth",{"grass": new LINK.Layers("leafs", "flowers")),
"sky": new LINK.Layers("birds", "clouds")
}, "ui");
layers.ground.earth.addChild(...);
layers.ground.grass.flowers.addChild(...);
layers.sky.clouds.addChild(...);
layers.ui.addChild(...);
Item Index
Methods
addLayer
(
-
layerName
Creates new layer with name layerName above others layers.
Parameters:
-
layerName
String
Returns:
DisplayObject
addLayerAt
(
-
Layer
-
index
Creates new layer with name layerName at specified index.
Parameters:
-
Layer
DisplayObject -
index
Number
getLayer
(
-
layerName
Returns the Layer with specified name or creates it
Parameters:
-
layerName
String
Returns:
DisplayObjectContainer
getLayerAt
(
-
index
Returns the Layer at the specified index
Parameters:
-
index
Number
Returns:
DisplayObjectContainer
removeChild
(
-
DisplayObject
Removes a child from the container.
Parameters:
-
DisplayObject
DisplayObject
removeLayer
(
-
String
Removes a layer from the container.
Parameters:
-
String
LayerName
swapChildren
(
-
LayerName
-
LayerName2
Swaps 2 Layers
Parameters:
-
LayerName
String -
LayerName2
String