Using Text Field to change MC size

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:

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 :slight_smile:

Thank you so much!

sends virtual carton of beer!

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!

lol… sorry, i don’t drink :stuck_out_tongue:

use this script to do what you just described:

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

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?

=)

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

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 =(

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

:beam:

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?

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

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’?

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

button 1:


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

button 2:


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

Have not tested it. But it should work I guess… :slight_smile:

U r a complete legend!.

works a treat.
Thanks guys!