Skip to main content
HarrowwInk
Known Participant
October 26, 2024
Question

How do I refresh the timeline with JSFL whilst in Edit Mode no matter what?

  • October 26, 2024
  • 2 replies
  • 286 views

Hi!

 

A stupid bug that I'm trying to circumnavigate my way around is one where I have to refresh the screen whilst in Edit Mode.

 

So far this is the only solution I can find that prioritises one type of Edit Mode.

// My solution
var dom = fl.getDocumentDOM(); 
var tl = dom.getTimeline(); 
var tlc = dom.timelines; var tnm = [];
for (var i = 0; i < tlc.length; i++){tnm.push(tlc[i].name);}
fl.trace(inEditMode()); // [insert any timeline altering code here]
refreshScreen();

// This refreshes the edit mode so that any glaring glitches may not show.
function refreshScreen(){
	if (inEditMode()){
		dom.exitEditMode(); 
		dom.enterEditMode('inPlace'); return true;} return false;
}

// This checks whether or not Edit Mode has been activated.
function inEditMode(){
	for (var i = 0; i < tlc.length; i++){if (tl.name == tlc[i].name){return false;}} return true;
}

 

The problems with these are as follows:

  • It can't differentiate between which mode the user was previously on
    • Because of that it won't be able to reapply the appropriate EditMode parameter
  • Edit mode requires a selection in the stage, which isn't always possible
    • The only workaround is to find a way to temporarily add an instance to the stage, select it, go into Edit Mode, and then delete that instance after in Edit Mode somehow.

 

Are there any other workarounds to these issues? I've tried searching for other workarounds but to no avail.

This topic has been closed for replies.

2 replies

Known Participant
November 14, 2024

I didn't tried but maybe you can have a look at document.viewMatrix ?

HarrowwInk
Known Participant
October 27, 2024

Just bumping so I can at least try and get at least some sort of response.

 

I'm just wondering if there's a way to tell what Edit Mode the user is currently on beforehand or if such a task is impossible with JSAPI.

 

Any response will do.

kglad
Community Expert
Community Expert
October 27, 2024