Copy link to clipboard
Copied
Hello, everybody.
It's not the first time i try do use the command "fl.getDocumentDOM().getTimeline().currentLayer = myLayerIndex" and it simply does nothing. The crazy thing is that it sometimes work, sometimes don't.
(in my case: it's currently selecting the top layer, with 0 as index)
layerIdx0 = 1;
fl.getDocumentDOM().getTimeline().currentLayer = layerIdx0;
fl.trace("Selected layer: "+fl.getDocumentDOM().getTimeline().currentLayer+" -> i tried to select "+layerIdx0+".");
the output above says: "Selected layer: 0 -> i tried to select 1.".
I've tried "fl.getDocumentDOM().getTimeline().setSelectedLayers(0);" as it appears on the documentation, but i get a javascript error saying "setSelectedLayers" is not a function.
I've also tried to make a fuction to force the selection of the layer, locking every layer that is not the one i want and making a new selection, and it still does not work.
I really (really) am out of ideas. I'm currently using Adobe Animate 2021.
Thanks in advance
Copy link to clipboard
Copied
do you have more than one layer on the main timeline?
Copy link to clipboard
Copied
Yes. i do.
But i just found the answer. It seems that there is a bug of the function identifying the number you pass. It worked now using a simple line "myLayerIndex= parseInt(myLayerIndex);". This forces myLayerIndex to be a number it recognizes.
My example above was not exactly as i was programming, i was using the "findLayerIndex" function to retrieve it.
Thanks!
Copy link to clipboard
Copied
you're welcome.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more