Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to change object size with inputtext in html5

Community Beginner ,
Dec 27, 2021 Dec 27, 2021

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

TOPICS
Code
384
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 27, 2021 Dec 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.

Translate
Community Expert ,
Dec 27, 2021 Dec 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 27, 2021 Dec 27, 2021

it's work, thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 28, 2021 Dec 28, 2021

you're welcome 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 29, 2021 Dec 29, 2021

Is it true if I  wanted the change to be applied when the button is clicked the code is like this?

 

start.on("click", function()
{
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;
}

});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 30, 2021 Dec 30, 2021
LATEST

if you have a start object, use:

 

this.start.on("click"),function(){

this.line_mc.scaleY=this.ti_value;

}

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines