# Problems with action scripting in a button

**URL:** <https://forum.kirupa.com/t/problems-with-action-scripting-in-a-button/306234>\
**Category:** Uncategorized\
**Created:** [March 11, 2010, 2:22pm UTC](https://forum.kirupa.com/t/problems-with-action-scripting-in-a-button/306234 "2010-03-11T14:22:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sirusbegins](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Sirusbegins](https://forum.kirupa.com/u/Sirusbegins)\
**Post date:** [March 11, 2010, 2:22pm UTC](https://forum.kirupa.com/t/problems-with-action-scripting-in-a-button/306234/1 "2010-03-11T14:22:14Z")

</div>

i have been trying to create a random text field appear at the press of the button, but now that i have it do that it is not playing the movie clip that is attached to file. below is what i have so far

}// the main array:  
main = [“Your Cool”, “Not today”, “Yes”, “No”, “Your going to die”, "wow ", “six”, “seven”, “eight”, “nine”];  
// make a copy of main array to destroy:  
for (i=0; i\<main.length; i++) {  
copy = main.concat();  
}  
// shuffle the copy by cutting random items out of it,  
// and pushing them into an empty holder array(called shuffled):

shuffled = [];  
for (i=0; i\<main.length; i++) {  
shuffled.push(copy.splice(random(copy.length), 1));  
}  
// make a textfield to display stuff  
\_root.createTextField(“tf”, 100, 300, 150, 200, 20);

// give the button its instructions:  
on (release) {  
cookie2.gotoAndPlay(2) ;  
\_root.bttn.onRelease = function() {  
// cut a word off the end of the shuffled array:  
blurb = shuffled.splice(shuffled.length-1, 1);  
// and display it in the textfield:  
\_root.tf.text = blurb;  
// If there is nothing left in the shuffled copy  
// repeat the process:  
if (shuffled.length == 0) {  
copy = main.concat();  
for (i=0; i\<main.length; i++) {  
shuffled.push(copy.splice(random(copy.length), 1));  
}  
}  
};
