Random transitions

I’ve been poking about with this today and in my head it works but currently it does nothing. My javaScript is a bit adhock at best but I have the following code into a function when it fires it is meant to apply a random transition when moving to the next scene. I have jquery included in my project for the random

var trans_type=["hypeDocument.kSceneTransitionInstant",

var trans = Math.floor(Math.random() * trans_type.length);
var picked = trans_type[trans];


I solved this, thanks anyway. The issue was that you cannot use a variable name instead of the transition which makes the whole random from an array thing pointless.
here is what I went with should anyone need it in the future

> var trans = Math.floor(Math.random() * 7); 
> switch(trans) {
> case 0:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionInstant);
> 	break;
> case 1:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionCrossfade);
> 	break;
> case 2:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionSwap);
> 	break;
> case 3:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionPushLeftToRight);
> 	break;
> case 4:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionPushRightToLeft);
> 	break;
> case 5:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionPushBottomToTop);
> 	break;
> case 6:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionPushTopToBottom);
> 	break;
> default:
> 	hypeDocument.showNextScene(hypeDocument.kSceneTransitionSwap);
> 	}

Your original code is fine but you have created strings and the transitions are actually built in variables :slight_smile: so write your array like this:

var trans_type=[hypeDocument.kSceneTransitionInstant,

cheers DBear. I knew it had to be something stupid