Hi, so i need to set all the children of a group to visible (both layers an groups). I wrote this recursive function:
function setChildrenToVisible(group){ var numberOfChildren = group.layers.length; for (var i = 0; i < numberOfChildren; i++){ group.layers[i].visible = true; if (checkIfLayerSet(group.layers[i])){ setChildrenToVisible(group.layers[i]); } } } function checkIfLayerSet(layerToCheck){ if (layerToCheck.typename == "LayerSet"){ return true; } else { return false; } }
It works, however I'm dealing with a lot of inner layers and it just takes too long with this approach. In the past using the Action Manager instead of the DOM made a significant change in performance. Is there a way to set all of the children of a given group to visible with the ActionManager rather than trying to access the DOM?
Thank you