Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Add keyframes for multiple selected frames and adjust symbol transparency to 0

Explorer ,
Apr 04, 2023 Apr 04, 2023
an.getDocumentDOM().getTimeline().convertToKeyframes();
an.getDocumentDOM().setInstanceAlpha(0);

The above code does not seem to be able to complete the requirements

TOPICS
ActionScript , Error , Exchange extensions , How to
675
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Apr 04, 2023 Apr 04, 2023

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
...
Translate
Engaged ,
Apr 04, 2023 Apr 04, 2023

If you describe in a little more detail what exactly you want to do, perhaps we can give you some meaningful advice.

 

 

- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 04, 2023 Apr 04, 2023

I would like to use a command to automatically add keyframes with 0 transparency for multiple frames

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 04, 2023 Apr 04, 2023

567.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2023 Apr 04, 2023

you have to select an object to apply setinstancealpha.  ie, loop thought the objects on those frames.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 04, 2023 Apr 04, 2023

Multiple objects selected

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 04, 2023 Apr 04, 2023

not with that code

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 04, 2023 Apr 04, 2023
LATEST

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);

 

 

- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines