# Random quotes

**URL:** <https://forum.kirupa.com/t/random-quotes/28924>\
**Category:** flash\
**Created:** [August 20, 2003, 6:19am UTC](https://forum.kirupa.com/t/random-quotes/28924 "2003-08-20T06:19:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ctrl\_Z](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Ctrl\_Z](https://forum.kirupa.com/u/Ctrl_Z)\
**Post date:** [August 20, 2003, 6:19am UTC](https://forum.kirupa.com/t/random-quotes/28924/1 "2003-08-20T06:19:15Z")

</div>

i’m trying to produce a one frame random quote field  
i have a dyn text field “quotebox” with the var of “quotefield”

rn=random(10);  
loadText=new loadVars();  
loadText.load(“quotes.txt”);  
quotern=[“quote”+rn];  
loadText.onLoad=function() {  
quotefield.text=quotern;  
};

that’s what i have for code  
on the qoutes.txt file i have quote1-quote10 listed

i can get the quotern to display in the text field but can’t get the quotes in the text field unless i do this

loadText.onLoad=function() {  
quotefield.text=quote10;

add the quote# to the code  
which then displays the quote

if anyone has any ideas

thanks

---

<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:** [August 20, 2003, 6:39am UTC](https://forum.kirupa.com/t/random-quotes/28924/2 "2003-08-20T06:39:01Z")

</div>

You use quotefield.text, so you’re not using it’s variable. Give the textfield the instance name quotefield. Then try this:

[AS]  
loadText=new loadVars();  
loadText.load(“quotes.txt”);  
loadText.onLoad=function() {  
rn=random(10);  
quotefield.text=this[“quote”+Math.floor(Math.round(rn)+1)];  
};  
[/AS]

Forgot to round 😉

---

<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:** [August 20, 2003, 6:39am UTC](https://forum.kirupa.com/t/random-quotes/28924/3 "2003-08-20T06:39:20Z")

</div>

[![](http://www.kirupaforum.com/images/search_top.gif)](http://www.kirupaforum.com/forums/search.php?s=) 😉

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=29808](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=29808)  
[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=29045](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=29045)

---

<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:** [August 20, 2003, 7:02am UTC](https://forum.kirupa.com/t/random-quotes/28924/4 "2003-08-20T07:02:21Z")

</div>

saweeeeeeeet  
thank you very much!!!  
both of you

---

<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:** [August 20, 2003, 7:03am UTC](https://forum.kirupa.com/t/random-quotes/28924/5 "2003-08-20T07:03:22Z")

</div>

No problem. 😛

---

<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:** [August 21, 2003, 2:05am UTC](https://forum.kirupa.com/t/random-quotes/28924/6 "2003-08-21T02:05:40Z")

</div>

ok how about this  
what if i wanted to add a next button to the movie

\_root.next.onPress=function(){  
quotefield.text=this[“quote”+Math.floor(Math.round(rn)+1)];  
}

is that what i’d use  
cause it’s not pulling any text at all with this

---

<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:** [August 21, 2003, 2:16am UTC](https://forum.kirupa.com/t/random-quotes/28924/7 "2003-08-21T02:16:50Z")

</div>

[AS]var index = 1;  
next.onPress = function() {  
quotefield.text = loadText[“quote”+index++];  
}[/AS]  
That’s the idea… 😛

---

<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:** [August 21, 2003, 2:22am UTC](https://forum.kirupa.com/t/random-quotes/28924/8 "2003-08-21T02:22:46Z")

</div>

ahhhh  
ok koool  
thanks again

---

<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:** [August 21, 2003, 2:24am UTC](https://forum.kirupa.com/t/random-quotes/28924/9 "2003-08-21T02:24:17Z")

</div>

You’re welcome. =)
