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

What is Framer? Join the Community
Return to index
Don Behm
Posted Oct 30 - Read on Facebook

Hello! I'm trying to create a menu of six items with a for loop and I'm having problems calling a specific Layer (sideBarMenuItem) in the loop. I gave each Layer a name when it was created but I can't seem to figure out how to reference it correctly. So in this example how would I call to say sideBarMenuItem[4] outside the loop? Thanks!

5 Comments

Jonas Treub

When you store each layer in an array you can get the reference by index. I created an example: http://share.framerjs.com/8gwebak4a13j/

Don Behm

THANK YOU!

Marc Krenn

Don, but if you want to keep those menuItems grouped using a superLayer (as shown in your screenshot) you can access those subLayers by "sideBarMenuContainer.subLayers[4]".

I know, it's a bit confusing at first:

generic array: "array[x].opacity = 0.5"
superlayer array: "superlayer.subLayers[x].opacity = 0.5"

Don Behm

Interesting! So Jonas Treub's suggestion worked nicely, but for future reference I should try including any parent superLayers in the target path. I think i might be getting the hang of this thing! Thanks guys!

Arved Baumgärtner

@Jonas Treub and Marc Krenn, in the Medium Prototype of Framer Examples, the array of layers gets called and bound like this to the scrollComponent: "sketch["scroll#{pageIndex+1}"].superLayer = scrollComponent.content". What is the way to acess subLayers here?

Read the entire post on Facebook