Pause the specified timeline in other scene?


(Aleksander) #1

Hi,

I can pause the specified timeline for the NO current scene?

For example,

I want return to main timeline of the first scene but without animation using “pause”.


(Mark Hunte) #2

You cannot do it while on another scene.

But you can do it with out a Pause Timeline Keyframe Action on the Main Timeline by using the Javascript APIs.

Put a function on the scene load of scene one. Which contains:

if (hypeDocument.currentSceneName() == "scene1"  && window.scenecount != 0){//-- check the scene and number of time we have been here before
	
	hypeDocument.pauseTimelineNamed('Main Timeline');//--pause the timeline
	
		

		
	}
		window.scenecount++;	//-- add 1 to the count

Put in the head file:

<script type="text/javascript">
	window.scenecount = 0;
</script>

When scene 1 loads for the first time the window.scenecount will b e 0 , so the main timeline will run.

Next time it will be 1 so the JS will pause the timeline.

runOnce.hype.zip (20.8 KB)


(Aleksander) #3

That worked, but when change the layout in the same scene no load the timeline.


(Mark Hunte) #4

Each layout has it’s own onload which you need to set


(Aleksander) #5

I tried to start the Timeline using on layout unload from vertical layout, but not worked.


(Mark Hunte) #6

hmm, I actually had a chance to look at this again,

If I use my example above and only add a layout to each scene, not changing anything else. I get the behaviour expected.
You do not need to add the JS to any other layout, just need to make sure it runs on the first scene/layout that runs.

So I do not know why yours is not working. Are you able to post your example that is not working.