Skip to main content
HarrowwInk
Known Participant
Oct 26, 2024 7:52 AM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

3 replies

Known Participant
Nov 14, 2024 4:13 PM UTC

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

Translate
HarrowwInk
Known Participant
Oct 27, 2024 5:21 PM UTC

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.

Translate
kglad
Community Expert
Community Expert
Oct 27, 2024 5:42 PM UTC