How do you refer to a layer from within its initialization?
for layer in  layer = new Layer layer.name = "tabBar" layer.height = 98 layer.y = Screen.height - layer.height
tabBar = new Layer height: 98 y: Screen.height - this.height
does not. Is there a better, supported solution?
(you'll have to imagine the correct indentation, don't know how to do that on Facebook)
@, in functions/ constructor otherwise just the property name
Hiya John Marstall, yeah, you can't reference the layer variable name or "this" from within the constructor. I often just use a variable outside of the layer constructor when I need one property to reference another, like:
size = 500
layerA = new Layer____width: size____height: size / 2
Framer has a built-in solution to bottom align a layer:new Layer y: Align.bottom
Thanks guys. Using "align" in the constructor is the correct answer here but I could see where more advanced calculations would be needed, say if you wanted a bottom margin. Appreciate it though.
You can add the margin as a function parameter. Like:Align.bottom(10)
Ah, right! /slaps forehead