Skip to main content
Known Participant
January 2, 2023
Question

JSFL Layer selection confusion

  • January 2, 2023
  • 1 reply
  • 165 views

I'm trying to write a jsfl script that will go through all selected frames and animate the MCs to fade in, hold for a second, then fade out, then stagger them one after the other.

But I'm having an issue with this, I think it should go through all selected frames, then alert with each of the layer numbers, but it is just repeating the last layer number.

If I have 3 layers, each with a MC, it alerts '2' x3 times in a row, I thougt it should trace '0', '1', '2'.

 

var el ;
var tl = an.getDocumentDOM().getTimeline();
var items = an.getDocumentDOM().selection;

for(var i=0;i<items.length;i++){
	el=items[i];
	el.selected = true;  
	alert(tl.currentLayer)
}

 

This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
January 3, 2023

Hi.

 

Each element is being selected in each iteration but the selected layer is not changing. You should use setSelectedLayers.

 

Please let us know.

 

Regards,

JC