# Combining variable and number

**URL:** https://forum.kirupa.com/t/combining-variable-and-number/165075
**Category:** flash
**Created:** [October 7, 2005, 11:12am UTC](https://forum.kirupa.com/t/combining-variable-and-number/165075 "2005-10-07T11:12:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Hommer](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@Hommer](https://forum.kirupa.com/u/Hommer)
#### Post date: [October 7, 2005, 11:12am UTC](https://forum.kirupa.com/t/combining-variable-and-number/165075/1 "2005-10-07T11:12:21Z")

</div>

I’d like to make a script that goes to and plays a random frame (label).  
I just can’t remember how to combine a variable and a number.  
I have 3 frames called “label1”, “label2” and “label3”  
My script looks like this:

\_root.frame = Math.floor(Math.random()\*3)+1;  
gotoAndPlay(“label”+\_root.frame);

But apparently it isn’t right.

How do I combine the text (“label”) with the number (\_root.frame) so that it i.e. will goto “label2”?
