# Dynamic text talking to buttons

**URL:** <https://forum.kirupa.com/t/dynamic-text-talking-to-buttons/165327>\
**Category:** Uncategorized\
**Created:** [October 10, 2005, 12:41pm UTC](https://forum.kirupa.com/t/dynamic-text-talking-to-buttons/165327 "2005-10-10T12:41:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m0fe](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@m0fe](https://forum.kirupa.com/u/m0fe)\
**Post date:** [October 10, 2005, 12:41pm UTC](https://forum.kirupa.com/t/dynamic-text-talking-to-buttons/165327/1 "2005-10-10T12:41:58Z")

</div>

Hello people

I’v been creating a little question and answer game, where a randome quote from an external file pop’s up and then you have two buttons as possible answers, The randome quots are in a text file that looks like this

quote1=blah blah blah blah blah&quote2=blah blah blah blah blah blah&quote3=blah blah blah blah blah

now what i would like help with is this… is it possible for me to put some script on the buttons that 1st has a set of quote numbers and when pressed looks at the dynamic text box to check if it has loaded a quote assigned to it!

this is the random script on the time line

ranQuote = new LoadVars();  
ranQuote.onLoad = function(success) {  
if (success) {  
RanNum = Math.ceil(Math.random()\*10);  
ran = this[“quote”+RanNum];  
quote\_txt.text = ran;  
}  
else {  
quote\_txt.text = “The text failed to load due to an error”;  
}  
}  
ranQuote.load(“Quotes.txt”);  
stop();

thanx
