# \-=Random Dynamic Text=-

**URL:** https://forum.kirupa.com/t/random-dynamic-text/63981
**Category:** flash
**Created:** [September 12, 2004, 3:59am UTC](https://forum.kirupa.com/t/random-dynamic-text/63981 "2004-09-12T03:59:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![birdboy0103](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@birdboy0103](https://forum.kirupa.com/u/birdboy0103)
#### Post date: [September 12, 2004, 3:59am UTC](https://forum.kirupa.com/t/random-dynamic-text/63981/1 "2004-09-12T03:59:23Z")

</div>

Hi, I made a dynamic textbox on an error page, and i’m gonna load 1 text file, but the text file contains 4 or 5 phrases. Can anyone tell me how to randomly select 1 phrase and show it?

Thanx a lot.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 13, 2004, 9:16am UTC](https://forum.kirupa.com/t/random-dynamic-text/63981/2 "2004-09-13T09:16:45Z")

</div>

separate each phrase with a **&**.

ie. &kirupatext0=hello&kirupatext1=bye&kirupatext2=go

then for your script to load the txt file, modify the variable such that it picks a random number which then attaches to another string, thus picking a random string  
eg

```auto
loadText = new loadVars();
loadText.load("kirupa.txt");

loadText.onLoad = function() {
		scroller.text = this."kirupatext"+random(2);
};

```

well, i’m not too sure if the scripting part is correct, but that’s the rough idea.  
[size=1]sorry if the coding part’s not right, do play around till you get it. don’t have time to try it out now and i’m not an AS expert :P[/size]
