Random Text - Is it possible?

  • Hello guys,


    is it possible to have a text field or showtext with random text?

    Ex: each time user enter a page it shows a different text OR, each time the user clicks on a plugin it shows a different text.

    Can be each line, or each paragraph being randomized.. don't know how, neither if it's possible.

    Thanks!

    Daniel

  • I don't know much about javascript, but looking at the documentation you should be able to do something like this:

    In your HTML file:

    Code
    <script type="text/javascript">
      function getrandomnumber() {
    	document.getElementById("krpanoSWFObject").set("rnumber", Math.random());
      }
    </script>

    In your XML in an event somewhere:

    Code
    js(getrandomnumber());

    would place a random number in the variable rnumber (as in get(rnumber);).

    You could then use the same method to obtain a random word. Do you want words from a prewritten text or gibberish?


    EDIT: There seems to be a variable called "random" in the xml root, though I don't know what it does. Maybe it returns a different result every time it's read?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!