Copy link to clipboard
Copied
an.getDocumentDOM().getTimeline().convertToKeyframes();
an.getDocumentDOM().setInstanceAlpha(0);The above code does not seem to be able to complete the requirements
Yes, @kglad is correct, you need to have a selection in order to execute setInstanceAlpha().
Immediately after executing convertToKeyframes(), there is no valid selection because we are in brand new keyframes. You can check this by using:
an.getDocumentDOM().getTimeline().convertToKeyframes();
an.trace( "selection: " + an.getDocumentDOM().selection );Therefore, after creating the keyframes, select all elements within them.
Something like this:
var doc = fl.getDocumentDOM();
var tml = doc.getTimelin...
Copy link to clipboard
Copied
If you describe in a little more detail what exactly you want to do, perhaps we can give you some meaningful advice.
Copy link to clipboard
Copied
I would like to use a command to automatically add keyframes with 0 transparency for multiple frames
Copy link to clipboard
Copied
Copy link to clipboard
Copied
you have to select an object to apply setinstancealpha. ie, loop thought the objects on those frames.
Copy link to clipboard
Copied
Multiple objects selected
Copy link to clipboard
Copied
not with that code
Copy link to clipboard
Copied
Yes, @kglad is correct, you need to have a selection in order to execute setInstanceAlpha().
Immediately after executing convertToKeyframes(), there is no valid selection because we are in brand new keyframes. You can check this by using:
an.getDocumentDOM().getTimeline().convertToKeyframes();
an.trace( "selection: " + an.getDocumentDOM().selection );Therefore, after creating the keyframes, select all elements within them.
Something like this:
var doc = fl.getDocumentDOM();
var tml = doc.getTimeline();
var frameSel = tml.getSelectedFrames();
tml.convertToKeyframes();
doc.selectNone();
for( var i = 0; i < frameSel.length; i+=3 ){
var xlayer = tml.layers[ frameSel[i] ];
var frm = xlayer.frames[ frameSel[i+1] ];
if( ! frm ) continue;
for( var j = 0; j < frm.elements.length; j++ ){
frm.elements[j].selected = true;
}
}
doc.setInstanceAlpha(0);
Find more inspiration, events, and resources on the new Adobe Community
Explore Now