I am trying to write a function that will give a new set of commands each time the function runs. This function will be attached to one single button that updates each time
The first time:
playFirst = function(){
var symbolInstance = hypeDocument.getSymbolInstanceById(‘userName1’)
symbolInstance.startTimelineNamed(‘play’, hypeDocument.kDirectionForward)
}
The second time:
playSecond = function(){
var symbolInstance = hypeDocument.getSymbolInstanceById(‘userName2’)
symbolInstance.startTimelineNamed(‘play’, hypeDocument.kDirectionForward)
}
Basically you want some kind of trigger that changes each time the function runs and then run a conditional on that trigger to call / run a set of commands. Like:
if (trigger == 1) {
// do something
trigger++;
} else if (trigger == 2) {
// do something else
trigger++;
}
Sure, depending on how you are getting the input. I’m going to assume an input tag.
var word = hypeDocument.getElementById('user-input-field').value;
if (word.toLowerCase() == "word-to-check") { // toLowerCase() does what it says and turns input value to lowercase
hypeDocument.functions().name_of_function_that_contains_increment_animation();
trigger = 1; // this is to make sure the animation starts at the beginning.
}