Skip to main content
Participating Frequently
December 27, 2021
Answered

how to change object size with inputtext in html5

  • December 27, 2021
  • 1 reply
  • 451 views

I have an object (line) and input text. I want the user can change the size of the object by themself. For example, I'm typing 2 in input text, and the height of the object will be 2 cm. Can anyone tell me the code? 

Fyi: my document type is HTML5

Thanks in advance

Sorry I'm not good in English. Hope you can understand my question

This topic has been closed for replies.
Correct answer kglad

if your textinput has instance name ti and your line is line_mc, you can scale it using the ti's value:

 

if(!this.ti_change_cbk) {
function ti_change(e) {
this.line_mc.scaleY = e.target.value;
}
$("#dom_overlay_container").on("change", "#ti", ti_change.bind(this));
this.ti_change_cbk = true;
}

 

whether it's 2cm depends on the screen size and resolution.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
December 27, 2021

if your textinput has instance name ti and your line is line_mc, you can scale it using the ti's value:

 

if(!this.ti_change_cbk) {
function ti_change(e) {
this.line_mc.scaleY = e.target.value;
}
$("#dom_overlay_container").on("change", "#ti", ti_change.bind(this));
this.ti_change_cbk = true;
}

 

whether it's 2cm depends on the screen size and resolution.

NIna12Author
Participating Frequently
December 28, 2021

it's work, thank you

kglad
Community Expert
Community Expert
December 28, 2021

you're welcome