# Using Text Field to change MC size

**URL:** <https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611>\
**Category:** Uncategorized\
**Created:** [June 6, 2003, 5:09am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611 "2003-06-06T05:09:00Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![1111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/1111/32/206_2.png) [@1111](https://forum.kirupa.com/u/1111)\
**Post date:** [June 6, 2003, 5:09am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/1 "2003-06-06T05:09:00Z")

</div>

Okies, a dumbo question.  
Anyone plz help me change the size of a MC by inputing numbers into a text field?.

ie Mc “box”, 2 text fields, “width” height", then type in say 50 in width, and 25 in height to alter the box?.

Thanks!!!  
:beam:

---

<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:** [June 6, 2003, 5:27am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/2 "2003-06-06T05:27:51Z")

</div>

```auto
myWidthTextfield.onChanged = function() {
myMC._width = number(this.text)
}
myHeightTextfield.onChanged = function() {
myMC._height = number(this.text)
}

```

have two textboxes and your movieclip names myWidthTextfield, myHeightTextfield, and myMC, and have the code above on the main timeline 🙂

---

<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:** [June 6, 2003, 5:44am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/3 "2003-06-06T05:44:34Z")

</div>

Thank you so much!

# sends virtual carton of beer!

---

<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:** [June 6, 2003, 5:46am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/4 "2003-06-06T05:46:50Z")

</div>

One, other question, is it possible also to have a plus or minus button, so you could enlarge or decrese the size by certain increments,  
ie + enlarges by 50, - makes smaller by 50???

Thanks for your time if u can help!

---

<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:** [June 6, 2003, 5:50am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/5 "2003-06-06T05:50:10Z")

</div>

lol… sorry, i don’t drink 😛

use this script to do what you just described:

```auto
myWidthTextfield.onChanged = function() {
        myMC._width += number(this.text)
}
myHeightTextfield.onChanged = function() {
        myMC._height += number(this.text)
}

```

---

<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:** [June 6, 2003, 5:57am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/6 "2003-06-06T05:57:43Z")

</div>

Hmmm, cant get it to work?.

Not sure what i did wrong.

I made a button, and applied the script to  
on release. Is that what u meant?

=)

---

<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:** [June 6, 2003, 6:07am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/7 "2003-06-06T06:07:54Z")

</div>

oh no… implement it just the way you did with the first script, have it on the main timeline 🙂

---

<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:** [June 6, 2003, 6:13am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/8 "2003-06-06T06:13:37Z")

</div>

Sorry, to waste ur time ahmed,  
I created a button, put the text on the timeline.  
Input the text into the 2 fields works gr8, but i have a button “plusbutton” which i want to make the “myMC” enlarge by 50, then when i press it again, another 50.

This is rather frustrating, as i really suck at actionscripting =(

---

<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:** [June 6, 2003, 6:14am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/9 "2003-06-06T06:14:07Z")

</div>

perhaps you could at least rebuild your entire script for that. 🙂

---

<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:** [June 6, 2003, 6:17am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/10 "2003-06-06T06:17:20Z")

</div>

:beam:

---

<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:** [June 6, 2003, 6:20am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/11 "2003-06-06T06:20:30Z")

</div>

Okay, that should have worked, but it doesnt send it to the correct proportions.

Plus the “plus” and “minus” buttons didn’t work…

maybe I should take up gardening instead?

---

<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:** [June 6, 2003, 6:20am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/12 "2003-06-06T06:20:47Z")

</div>

no… not exactly… sorry… im out of my mind… lolz… forget my comments.

---

<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:** [June 6, 2003, 6:24am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/13 "2003-06-06T06:24:39Z")

</div>

Thanks anyway Rv, and Thanks Ahmed, works well,  
do u think i should just forget about having buttons to also to increase or decrease the size of the ‘myMC’?

---

<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:** [June 6, 2003, 6:34am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/14 "2003-06-06T06:34:06Z")

</div>

you dont have to. there nothing impossible if u should try harder. ok… have this a try.

button 1:

```auto

on (press) {
 myMC._width = myMC._width*2;
 myMC._height = myMC._height*2;
}

```

button 2:

```auto

on (press) {
 myMC._width = myMC._width/2;
 myMC._height = myMC._height/2;
}

```

Have not tested it. But it should work I guess… 🙂

---

<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:** [June 6, 2003, 6:39am UTC](https://forum.kirupa.com/t/using-text-field-to-change-mc-size/22611/15 "2003-06-06T06:39:24Z")

</div>

U r a complete legend!.

works a treat.  
Thanks guys!
