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

What is Framer? Join the Community
Return to index
Ermal Turkesi
Posted May 15 - Read on Facebook

Hi there,
Is there a way to select a layer by just passing a variable name?
Now sure if I'm clear but here is a sample of what I was thinking...

[currentItem.name].addButton.visible = false

Thanks.

5 Comments

Malcolm Ellis

Hi Erm, try targeting the children of currentItem like so... [currentItem].children[0].visible = false

If you have more than one child in your current item, you can iterate through the children like so,
for all in arr[currentItem].children
if all.name == "addButton"
all.visible = false

Ermal Turkesi

Thanks so much, Malcolm! The second option worked great. :)

Ermal Turkesi

I did "for all in currentItem.children" what is the arr[] for?

Malcolm Ellis

Hi Erm, glad it worked for you. The arr[] is just a remnant from my test code. I had several items in an array called arr and I used a variable called currentItem = 1 to specify the index of the item I was targeting.

Ermal Turkesi

I see, thanks!

Read the entire post on Facebook