# Me need help

**URL:** <https://forum.kirupa.com/t/me-need-help/12571>\
**Category:** Uncategorized\
**Created:** [February 2, 2003, 12:06am UTC](https://forum.kirupa.com/t/me-need-help/12571 "2003-02-02T00:06:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cripple\_Guy](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@Cripple\_Guy](https://forum.kirupa.com/u/Cripple_Guy)\
**Post date:** [February 2, 2003, 12:06am UTC](https://forum.kirupa.com/t/me-need-help/12571/1 "2003-02-02T00:06:43Z")

</div>

there are 4 dynamic texts with numbers… and i wanted to know how to do a subtract on one of the 4 dynamic texts randomly…

---

<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:** [February 2, 2003, 3:26am UTC](https://forum.kirupa.com/t/me-need-help/12571/2 "2003-02-02T03:26:55Z")

</div>

me not understand. Can U explain in detail (how about an example?)

---

<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:** [February 2, 2003, 3:29am UTC](https://forum.kirupa.com/t/me-need-help/12571/3 "2003-02-02T03:29:50Z")

</div>

MONTOYA YOUR BACK!!!

2 posts in two nights (that I saw), is it true, are you back!?!?!

:love:

I think I MIGHT understand, lemme try and whip something up.

---

<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:** [February 2, 2003, 3:45am UTC](https://forum.kirupa.com/t/me-need-help/12571/4 "2003-02-02T03:45:00Z")

</div>

OK

First thing First.

Create \<B\>5\</B\> textboxes on the stage. Give each an \<B\>INSTANCE\</B\> name of textBox#, like this…

textBox1  
textBox2  
textBox3  
textBox4  
textBox5

Now on a frame add these actions…

```php
_root.textBox1.text = 10;
_root.textBox2.text = 20;
_root.textBox3.text = 30;
_root.textBox4.text = 40;
ranNum1 = Math.round(Math.random()*(4-1)+1);
ranNum2 = Math.round(Math.random()*(4-1)+1);
box1 = _root["textBox"+ranNum1].text;
box2 = _root["textBox"+ranNum2].text;
_root.textBox5.text = box1+"-"+box2+" = "+(box1-box2);

```

This assings numbers to each of those textboxes. 10, 20, 30, and 40 as you see.

ranNum1 chooses a number from 1 to 4 to find out which textBox to choose for the first box.

ranNum2 chooses a number from 1 to 4 to find out which textBox to choose for the second box.

box1 takes the number supplied by ranNum1 and tacks it onto the word “textBox” creating one of the instance names of your textbox. It basically turns it into \_root.textBox#.text. Where # is the number ranNum1 produces.

box2 does the same but using ranNum2.

the last line here shows the number taken from box1 and box 2, then the results of subtracting them.

Check my example file to see it in action.

---

<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:** [February 2, 2003, 7:21am UTC](https://forum.kirupa.com/t/me-need-help/12571/5 "2003-02-02T07:21:45Z")

</div>

im saying like… there is for text numbers

exsample:  
four numbers that are in dynamic text:

150  
200  
250  
175

and when it subtracts it randomly picks one of those…

i already did the random subracting numbers like “Math.floor(Math.random() \* (20 - 10)) + 10;”…

---

<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:** [February 2, 2003, 7:22am UTC](https://forum.kirupa.com/t/me-need-help/12571/6 "2003-02-02T07:22:52Z")

</div>

That is what my code does. Except I assigned the number to the textbox through AS.
