Loop 3 times then stop at an earlier specific time?

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) {
		window.loopCount++;
		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

1 Like

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

1 Like

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

Nice one!

300x250_Casino_10CADFORUm.hype.zip (59.3 KB)

I am trying to do the same thing, but struggling. I have made the banner loop x3 times, but I want it to end on around 8 seconds. Could anyone help?

300x250_Casino_10CADFORUm.hype.zip (70.6 KB)

2 Likes

Easy when you know how! thank you very much :grinning:

Legend!!