Quick tip: here's a way you can add a set of states to multiple layers. (I've had a few people ask me if this was possible, so figured I'd make a quick example.)
Benjamin, thanks for this. In your code you handle the click events for layerA and layerB the same way. Is there a way to consolidate this?
layerA.on Events.Click, -> this.states.next("one","two")layerB.on Events.Click, -> this.states.next("one","two")
layerA.on Events.Click, ->layerB.on Events.Click, -> this.states.next("one","two")
But that didn't work.
One option would be (substitute ~ for tab):
Layers.map (layer) ->~layer.on Events.Click, ->~~layer.states.next("one", "two")
Hey Amy, definitely. You could also include the click event in the loop:
Thanks! Benjamin Den Boer Is there a way to define sublayer's attributes in the parent layer's state?
Hey Jingshu, you can't nest states, as in, define properties of child layers when defining the states of the parent layer. You could use the same trick for subLayers, though. (Or include them) :)