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

jsfl symbol keyframe detection

New Here ,
Nov 22, 2019 Nov 22, 2019

Copy link to clipboard

Copied

is there any possible way to find where there are keyframes in a symbol

for example say I've made a graphic symbol for the characters head and I want to be able to use a jsfl command to find where there are keyframes inside the symbol and then shake the head symbol on a keyframe at the same time there is a keyframe inside of the symbol (to replecate the south park effect)

TOPICS
Code , How to

Views

752

Translate

Translate

Report

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 , Nov 23, 2019 Nov 23, 2019

Hi,

Yes, you can detect keyframes in a symbol's internal timeline.
But, a keyframe is a property of a layer, not to a timeline at given frame. So, you must specify the layer from the internal timeline.
Here is a piece of code, that can be used as a starting point. It detects the internal keyframes in the selected symbol on the stage and outputs them as array of arrays.

 

 

 

function getKeyFrames( tml ){
	
	this.isKeyFrame = function( timeline, layerNum, frameNum ){
		if( ! timeline.layers[ layerNum ].
...

Votes

Translate

Translate
Engaged ,
Nov 23, 2019 Nov 23, 2019

Copy link to clipboard

Copied

LATEST

Hi,

Yes, you can detect keyframes in a symbol's internal timeline.
But, a keyframe is a property of a layer, not to a timeline at given frame. So, you must specify the layer from the internal timeline.
Here is a piece of code, that can be used as a starting point. It detects the internal keyframes in the selected symbol on the stage and outputs them as array of arrays.

 

 

 

function getKeyFrames( tml ){
	
	this.isKeyFrame = function( timeline, layerNum, frameNum ){
		if( ! timeline.layers[ layerNum ].frames[ frameNum ] ){
			return false;
		}
		return ( timeline.layers[ layerNum ].frames[ frameNum ].startFrame === frameNum );
	};	
	
	var retval = [];
	
	for( var i = 0; i < tml.layers.length; i++ ){
		var layerKeyFrames = [];
		for( var j = 0; j < tml.layers[ i ].frames.length; j++ ){
			if( this.isKeyFrame( tml, i, j ) ){
				layerKeyFrames.push( j );
			}
		}
		retval.push( layerKeyFrames );
	}
	return retval;
}


fl.trace( getKeyFrames( fl.getDocumentDOM().selection[0].libraryItem.timeline ) );

 

 

 

 

 

- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation

Votes

Translate

Translate

Report

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