This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Lorenzo Fernandez
Posted Nov 14 - Read on Facebook

I'm trying to assign a trigger event via for to a groupd of layers. But indipendently of which layer I over it only trigger the state to the first layer :

# 1. go through the folder and assign to each layer the states
# 2. on event go to the state

for layerId of lines.Ovals.subLayers

# add the different states

# add animation option
level.states.animationOptions =
curve: "spring"
curveOptions: {tension:500, friction:6,velocity:5}

# on mouse over do…
level.on Events.MouseOver, (event) ->
level.states.switch "over"

# on mouse out do…
level.on Events.MouseOut, (event) ->
level.states.switch "out"


Benjamin Den Boer

Is this what you're looking for, perhaps?

(Adding states to multiple layers)

Benjamin Den Boer

Otherwise, could you attach a your prototype or a new .framer document with your code?

Lorenzo Fernandez

i managed to assign the states, but i'm having a problem triggering the event. Also in the example you sent you assign the events manually not via FOR. Is there a way to do it programmatically?

Benjamin Den Boer

Sure, in the example I linked to you can simply add the events within the "for" loop, like this:

Andreas Mitschke

How is layerID declared and what's the superLayer ?

Don't see something wrong except what's happening before and I wouldn't fill a variable instead use "this", but without the stuff before this, can't help.

Lorenzo Fernandez

Benjamin Den Boer in you example (if i understand correctly) you assign the event manually
"layerA.on Events.Click, ->"one","two")"

Cant you do something like
layers.on Events.Click, ->"one","two")

Lorenzo Fernandez

Andreas Mitschke hem, its not declared. :) But i thought that with coffee script you didnt have to. (I'm clearly not a pro)

Benjamin Den Boer
Lorenzo Fernandez


Lorenzo Fernandez


Read the entire post on Facebook