Timeline does not continue playing

Hi there,
I’m a graphic-designer and new to Hype (great program). So my programming skills are not very advanced, in fact there aren’t any at all, sorry, but willing to learn. Now here’s my tiny problem:

I created a time bar (actually it’s called a timeline but I don’t want to confuse everyone) in Hype. It’s made for a Samsung tablet for an exhibition.

You can scroll the time bar with your finger or drag it with the mouse. Click on the pictures and you will jump to a new scene to get more information. Here it is: http://prima-propaganda.de/ZeitleisteTest.html

Now: when I jump back from the detail page to the main timeline it starts of course from the beginning. I want to tell the main timeline to jump to the point where I left it for the detail page and continue from there.

I found this in another post and I tried tried it before:

But the time line then can only be scrolled to the right. It ist not possible to scroll left “behind” the 2.00

I will be obliged to hear from you tough programmers.
Rookie greetings.

Hi There! As you haven’t shared a document I cannot give you a personalised solution but here is an example that hopefully you can take away from it and add to your own project.

Basically you would set a global variable in a function on scene load. We will use this to record the time later. But initially we will run a condition. If the global variable is set or has a value then go to that time in the timeline if it isn’t / does not then go to 0.

window.time;

if (window.time == null || window.time == "undefined") {
	hypeDocument.goToTimeInTimelineNamed(0, 'timeline1') // of course you would put here your own timeline name
} else {
	hypeDocument.goToTimeInTimelineNamed(window.time, 'timeline1')
}

Now to set the time whenever you click an element. On said element you need to run another function “on mouse up (touch end)” this function will record the current time in the timeline and save it in our global variable

// the global variable just without "window"
time = hypeDocument.currentTimeInTimelineNamed('timeline1');

Now when you drag the timeline and click anywhere once the mouse / finger has left the screen the click and mouse up (touch end) actions fire and you should have the current time loaded into a variable. When you navigate back to the original scene the function sets the timeline’s time to the time stored in the variable.

crude Example:
rememberTimeInTimeline.hype.zip (29.4 KB)

1 Like

Hi DBEar,

thanks for your help. What a need little script. I hope that I installed it correct:

What I did was to use the first part of the script on the Szene on load (Funktion: VariableHauptzeitachse()

Then I used the second part of the script on the pictures that should jump to another scene (gettingtime():

What happens is that when I hit the back button I jump back to the beginning of the main scene and then the scene jumps to the last exit point. In your example it works very well but I can’t install it on my timeline. What did I do wrong?

I uploaded the new document on my server. I put the script on the picture of 1983-85 and 2003 to test it:

www.prima-propaganda.de/ZeitleisteTest.html

and I uploaded the Hype-Dokument as a Zip File if you want to download it:

www.prima-propaganda.de/Zeitleiste1080p.zip

Hi,

You must target your “Main Timeline” in all cases as this is the timeline you are using. So change where it says “timeline1” in the code to “Main Timeline” and you should be good. Everything else you did is fine.

I found the mistake I made.

The targeting was correct, but: on the detail page the back button was set to a “crossfade transition”. When I changed that to an “immediate transition” it works just fine.

Thanks an awful lot for your help!

Just to clarify the behavior - an instant scene transition will happen immediately, so the new scene can be targeted. However, any of the other scene transitions are an asynchronous affair - the new scene is not technically loaded until the transition is complete so you’d still be targeting the old scene. If you need to know the moment a scene transition is complete, you can use the On Scene Load action handler (or register for the HypeSceneLoad event in javascript).

1 Like