How do I Create code in JavaScript for a button that will show random scenes in my hype project?

(steven Lashley) #1

Do I make an array with the scenes and use math.random function?


Yep. That’s about it :wink:

Hype’s API would make things nice and easy (providing you are using unique names in all your scenes)

var scenes = hypeDocument.sceneNames();
function getRandomScene(length) {
    return Math.floor(Math.random() * Math.floor(length));


Elegant :sunny:

(steven Lashley) #4

Thank you DBear!