Random Elements


#1

Hi,

I am working on a project that requires at the press of a button to return a random piece of information. Does anyone have any advice on how best to achieve this? here is an example of something similar http://www.grand-national.me.uk/redrumstips/ every time the button is pressed a random selection of the horses running in the grand national is presented. I’m assuming that javascript is involved but along with how to do it where in the animation is best to apply it?


(Andrew) #2

How about something like this:

randomElements.hype.zip (16.9 KB)

This has ten text boxes with peoples names. You click catch, and it will catch a name, start a timeline, and continue it to fade out after a second.

Not sure what you really want to do, but it’s a start.


#3

Thanks,

That helped but wasn’t quite what I needed to do. However I have worked it out from your suggestion.

First I created a symbol with each bit of info written on a separate layer which I made invisible, I then gave each of those layers a unique name followed by a number. Eg: Pick1, Pick2, Pick3 etc.

Then I created the following javascript action:

var number = Math.floor(Math.random()*(14-1+1)+1);
hypeDocument.getElementById(‘Pick’+number).style.display = “block”;

Finally I had the action run through ‘On Symbol Load’ within the symbol inspector.

Hope this helps anyone else who may need to do a similar project.