Loop 3 times then stop at an earlier specific time?

(J S Poyser) #1

Hi there, Ive seen lots of discussions about looping timelines and the only method I have found is to place 2 actions in the timeline.

1st Action, include Javascript to loop 3 times-

    if (window.loopCount == null) {
		window.loopCount = 0;

	if (window.loopCount < 2) {
		hypeDocument.startTimelineNamed('Main Timeline', hypeDocument.kDirectionForward);

2nd Action, include javascript to stop at a specific point-

hypeDocument.pauseTimelineNamed(‘Main Timeline’);

This works fine if you want it to stop beyond the point of the last loop.

Is there a way to enable it to stop before the end of the last loop?

Many thanks


Yes. Place a timeline action where you want it to pause and run a Javascript->New Function that checks the condition of the loop count for example if window.loopCount == 1 then pause the timeline.

if (window.loopCount == 1) {
    hypeDocument.pauseTimelineNamed('Main Timeline');

The number used is dependent on how many loops you have

(J S Poyser) #3

DBear, thank you very much for that. I can now save as a template and create some cool ads.

Nice one!