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

Letter limit and move to other box Adobe Animate HTML5 Canvas

Explorer ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

What do I need to do to get only 1 letter written?

What should I do to switch to the next box after typing?

Umut24780391qa8w_0-1656402395981.png

Umut24780391qa8w_1-1656402474498.png

 

 

 

Views

248

Translate

Translate

Report

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 , Jun 29, 2022 Jun 29, 2022

that's my error.  focusA != this.focusA, so 

 

for(var i=0;i<focusA.length;i++){

 

should be

 

for(var i=0;i<this.focusA.length;i++){

Votes

Translate

Translate
Community Expert ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

what determines the end of typing? (eg, the enter key press)

what's the instance name of the "next" textfield?

are those dynamic textfields?

are you listening for keyboard events and then adding text using js?

Votes

Translate

Translate

Report

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
Explorer ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

No problem thanks,

but What do I need to do to get only 1 letter written?

(textinput)

Votes

Translate

Translate

Report

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 ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

that's a mistake.  (using a textinput component.)  as mentioned before you should be using a dynamic textfield.

 

but if that's what you want, this will do what you want and set you up to continue to the next problem:

 

this.focusA = [];

document.addEventListener('keyup', f.bind(this));

function drawEndF(){
this.focusA.push(document.getElementById("ti_1"));  // where ti_1 is a text input component.  you'll want to loop through them all here
}


stage.on("drawend", drawEndF, this, true);

 

function f(e){
for(var i=0;i<focusA.length;i++){
if(this.focusA[i] == document.activeElement){
this.focusA[i].value = this.focusA[i].value.slice(-1);
}
}
}

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

>function f(e)

 

I, for one, appreciate the use of descriptive function names here. So many people write code with cryptic function names that can make the intent of code hard to follow.

Votes

Translate

Translate

Report

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 ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

@ClayUUID, just for you:

 

this.focusA = [];

document.addEventListener('keyup', keyUpF.bind(this));

function drawEndF(){
this.focusA.push(document.getElementById("ti_1"));  // where ti_1 is a text input component.  you'll want to loop through them all here
}


stage.on("drawend", drawEndF, this, true);

 

function keyUpF(e){
for(var i=0;i<focusA.length;i++){
if(this.focusA[i] == document.activeElement){
this.focusA[i].value = this.focusA[i].value.slice(-1);
}
}
}

Votes

Translate

Translate

Report

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
Explorer ,
Jun 28, 2022 Jun 28, 2022

Copy link to clipboard

Copied

Umut24780391qa8w_0-1656480224741.png

Is this the only place I would name the code based on my project? because i am getting error

Umut24780391qa8w_1-1656480377330.pngUmut24780391qa8w_2-1656480434288.png

 



Votes

Translate

Translate

Report

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 ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

LATEST

that's my error.  focusA != this.focusA, so 

 

for(var i=0;i<focusA.length;i++){

 

should be

 

for(var i=0;i<this.focusA.length;i++){

Votes

Translate

Translate

Report

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