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.
