How to link to a symbol timeline with java



I tried almost every constellation, but nothing will work.
I want to jump from a scene to a symbol timeline.

here is the last code I tried, but sometime it jumps to the Mainpage and sometimes nothing happens.

var scene = hypeDocument.currentSceneElement(),
symbol = hypeDocument.getSymbolInstanceById(‘mainnavi’);

scene.getElementsByClassName(‘bigImageContainer’)[0].style.backgroundImage = null;
scene.getElementsByClassName(‘title’)[0].innerHTML = ‘’;

symbol.goToTimeInTimelineNamed( 1, ‘galerie’);

I hope someone can help me.



The problem here is the code does not execute in a precise sequential manner…

So before we go further let’s use “Scene 1” and “Scene 2” for our scene names.

Hype has not actually left the current Scene (“Scene 2”) and gone to “Scene 1” (“showPreviousScene”) when “symbol.goToTimeInTimelineNamed(1, ‘galerie’);” is executed - it is still on “Scene 2”; so the command “symbol.goToTimeInTimelineNamed(1, ‘galerie’);” does not work because this symbol is not in the current scene ( “Scene 2”).

One way around this conundrum is to set a variable “flag” in a function (“setFlagTrue”) that when triggered in Scene 2 (such as a button is clicked) sets the flag to “true” and then goes to the Previous Scene (“Scene 1”):

    symbolTimelineFlag = "true";

Now in the "On Scene Load" handler for "Scene 1" we have the following function ("flagCheck"):
       if(symbolTimelineFlag == "true") {
		var symbol = hypeDocument.getSymbolInstanceById('mainnavi');
		symbol.goToTimeInTimelineNamed(1, 'galerie');

which then sets the Symbol ‘mainnavi’ - which exists in in “Scene 1” (now our current Scene) - to 1 second in the ‘galerie’ timeline.

Demo Project: (29.6 KB)


Thanks a lot! That works fine. WOW such nice help with the explanation.