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

What is Framer? Join the Community
Return to index
Nick Kutateli
Posted Mar 15 - Read on Facebook

What's the best way to get a child within child layer? Is there something clean like view.header.button vs view.childrenWithName("button")[0]?


Kevyn Arnott

There's no built in way that I know of. You can set these names up pretty easily. When you declare a layer, you can write – view.header.button = new Layer, or you can do it below the new Layer statement – view.header.button = button. Wherever view is in scope, you'll be able to reference the button with view.header.button. Hopefully, that helps.

Nick Kutateli

Thanks for the tip, Kevyn Arnott! I'm looking to do this specifically to target layers attached to a view that's being generated in a loop. So I can target specifically view[0].header, view[1].header, etc.. I know I can do the same with childrenWithName.. but it just doesn't seem clean or correct.

Kevyn Arnott

Are you able to share your prototoype?

Nick Kutateli

Unfortunately not, sorry!

Mike Johnson

I made a module for this, and a video to help use it.

Kevyn Arnott

Hmm okay, there are a couple ways to do this. Probably the best would be to create an object that stores all the views. Here's an example of it: It'll at least give you the syntax you're looking for.

Read the entire post on Facebook