I wonder if there is a better way than the code below to play an animation until reaches a position defined by a variable.
Symbol.bindTimelineAction(compId, symbolName, "Default Timeline", "update", function(sym, e) {
// insert code to be run on every tick of the timeline here.
// Be careful not to block or do too much work!
//get the value of a Symbol variable
var myVariable = sym.getVariable("myVariableName");
//check if playhead position reached my Symbol variable
//must use >= not == to ensure it works
if (sym.getPosition() >= myVariable) {
sym.stop();
}
Note the code must be in the "update" timeline event to work, but I don't like much to do that. "Stop at" method doesn't work the same way cause it just moves the playhead position instantly, so the animation doesn't run at all.
I miss one more optional parameter in the "Play from" and "Play Reverse from" methods to determine an interval to play. Something like...
sym.play ( start, finish, executeTriggers )
sym.playReverse ( start, finish, executeTriggers )