Looping a banner


#1

Hi there.
Noob user, normally a heavy CS user, but wanted to clean out and try other options.

Making a simple 300x100 banner for a site. Everything looks fine, and on preview it does seem to be ok.
Once exporting as HTML5 the loop function stops suddenly. Why is this?

I am trying to convince everyone to stop using flash and switch to html5, but I can’t get the damn thing to loop… lol.

Any help would be great.

Cheers


(ocultor) #2

add a timeline action, thats it:


(Greg) #3

Do a search on this forum for “How to loop” and you’ll get a lot of great info.


(Bryann) #4

What happens if I want to do this 4x? Is there a simple way?


#5

Hi Bryann!

Hype Project: loopTracking.hype.zip (19.6 KB) - Demo here.

On the timeline at the end there is a “Timeline Action” keyFrame that triggers the function “trackLoopNum()” and restarts the timeline (until 4 loops have been completed).

In the “Head HTML” of the project the global variable “counter” is initialized.

The code that does the main work is the function “trackLoopNum()” There is more code in the function in the actual project. This extra code serves mainly to manipulate on the on-screen animation. Below is the “core” aspect of the “loop counter” with the (extra) code stripped out:

	if (counter == 4) { // code to execute when we hit our loop num
	hypeDocument.goToTimeInTimelineNamed(0, 'Main Timeline');
	hypeDocument.pauseTimelineNamed('Main Timeline');
	}
	else if (counter > 4) { // reset loop cycle
		counter = 0;
	}
	
	counter = counter+1; // if under "4" loops then augment the counter

This scenario shows the basic idea… You of course will need to adapt this to your own situation.