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

What is Framer? Join the Community
Return to index
Johannes Eckert
Posted Oct 18 - Read on Facebook

when I create a bunch of views in a loop with new View() and set view.name = "view"+i, can I reference this view by name? say view["view5"].x ?

5 Comments

Johannes Eckert

…instead of looping through them again with a .foreach or try to hit for the right one with subViews[i]

Julius Tarng

i believe you can generate these views via window[view + i] = ...

Julius Tarng

and they'd be accessible by "view1" , "view2" etc

Julius Tarng

for reference, Cemre created this in our framer template to turn all PSD[layergroupnames] into view names of layergroup name

for (var layerGroupName in PSD) {
window[layerGroupName] = PSD[layerGroupName]
}

Johannes Eckert

ohyeah — that did the trick.

Array.map(function(i) {

view = new View({

window["view"+i] = view;
});

});

then I can access them by simply targeting view4.x

Read the entire post on Facebook