Navigation with text fields


(Marco Orlandini) #1

It’s possible to create a text field, with a “go to” button, that allows to go to a specific scene, writing in it the name of the scene?
Thanks in advance


#2

Hi Marco:

Yup! Here’s how you would set this up:

Create an input form with the ID set as scenename, then run the following function after you click a button on that same scene:

// Get an array of all scene names. 
scenesarray = hypeDocument.sceneNames();
 	

// grab the value of the Scene Name input element. 
var inputScene = document.getElementById('scenename').value;

// If the inputted scene name exists in the array of scenes, jump to it. 
if ( scenesarray.indexOf(inputScene) > -1)
{
hypeDocument.showSceneNamed(inputScene, hypeDocument.kSceneTransitionCrossfade, 1.1)
}

Here’s an example: scene-jumper.zip (31.2 KB)


(Marco Orlandini) #3

Thank you very much Daniel