Dynamic variables for playing a timeline

I was trying to write code for dynamic variables that would play a group of 3 timelines in order depending on which the user clicked. I started to use eval() but ran into problems with the apostrophes and the playTimeline function.

If I try to use eval() dynamically with
hypeDocument.playTimelineNamed(‘verb1’, hypeDocument.kDirectionReverse, false); where I want the timeline name to be verb1 verb2 or verb 3, I get something like:

for (var x=1; x < 3; x++) {

eval('hypeDocument.playTimelineNamed(/'verb' +x + '/', hypeDocument.kDirectionForward, false);')`

}

(From what I read using eval() is bad for a number of reasons but I didn’t understand the other options like making an array of objects or symbols)

No need for any evals...

Just give each button a class name, corresponding to the name of the timeline it is supposed to start and run the following script

var myTimeline = element.classList[1]; // get the button´s/timeline´s name
hypeDocument.startTimelineNamed(myTimeline, hypeDocument.kDirectionForward); // start it

timeline.zip (18.6 KB)

This has been answered already in