Skip to main content
This topic is closed to new replies. Start a new post to keep the conversation going.
Vladin M. Mitov
Vladin M. MitovCorrect answer
Inspiring
Sep 14, 2022 8:41 AM UTC

Hi,

Here is an example that clears all keyframes at the current frame:

(function(){

	var isKeyFrame = function( fr, fn ){
		return ( fr.startFrame === fn );		
	};
	
	var doc = fl.getDocumentDOM(),
		tml = doc.getTimeline(), i, xframe,
		cf = tml.currentFrame, cf1 = cf + 1,
		tmlSel = [];

		
	for( i = 0; i < tml.layers.length; i++ ){
		xframe = tml.layers[ i ].frames[ cf ];
		if( ! xframe ) continue;
		if( ! isKeyFrame( xframe, cf ) ) continue;
		tmlSel.push( i, cf, cf1 );
	}
	
	tml.setSelectedFrames( tmlSel, true );
	tml.clearKeyframes();

})();



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

3 replies

kqskcmAuthor
Known Participant
Sep 14, 2022 3:39 AM UTC

// select all an.getDocumentDOM().selectAll(); // Clear keyframes an.getDocumentDOM().getTimeline().clearKeyframes();

This code requires manual selection of all keyframes

Translate
Vladin M. Mitov
Vladin M. MitovCorrect answer
Inspiring
Sep 14, 2022 8:41 AM UTC

Hi,

Here is an example that clears all keyframes at the current frame:

(function(){

	var isKeyFrame = function( fr, fn ){
		return ( fr.startFrame === fn );		
	};
	
	var doc = fl.getDocumentDOM(),
		tml = doc.getTimeline(), i, xframe,
		cf = tml.currentFrame, cf1 = cf + 1,
		tmlSel = [];

		
	for( i = 0; i < tml.layers.length; i++ ){
		xframe = tml.layers[ i ].frames[ cf ];
		if( ! xframe ) continue;
		if( ! isKeyFrame( xframe, cf ) ) continue;
		tmlSel.push( i, cf, cf1 );
	}
	
	tml.setSelectedFrames( tmlSel, true );
	tml.clearKeyframes();

})();



Translate
- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
kqskcmAuthor
Known Participant
Sep 14, 2022 9:38 AM UTC

Perfect

Translate