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

Animate v2301 HTML5 Canvas placing variables in wrong dynamic text locations

Contributor ,
May 29, 2025 May 29, 2025

On a frame I have 5 Dynamic Text objects:

JefferyWright_0-1748528179248.png

On that frame I am directing variables to populate these objects:

this.sctn_HDR.text = sctn_AA2A;
this.AA2_Copy.text = AA2_copy;

this.PC1.text = AA2_PC1;
this.PC2.text = AA2_PC2;
this.PC3.text = AA2_PC3;

These are the varible strings:

sctn_AA2A = "SciLog Cryobag Filler System";
AA2_copy = "The SciLog Cryobag Filler...";

AA2_PC1 = "Single Use Sensors & Monitors";
AA2_PC2 = "Single Use Assemblies";
AA2_PC3 = "Bioprocess Containers";

 

So, what's the deal with this misplacement of the variables I assigned? 

 

JefferyWright_1-1748528453342.png

 

Why is Animate making my variables appear where I did not indicate? 

 

Why, for example, is PC3 not displaying the string I assigned to it? 

 

Advanced layers on or off makes no difference. 

 

Anyone else running into this issue? 

 

Thanks.

 

 

 

 

 

 

TOPICS
Product issue
1.0K
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 , May 29, 2025 May 29, 2025

all those dynamic textfields were in a problematic layer.  why it is problematic, i don't know.  it may have been a guide layer previously or a camera layer or hidden or something else.  or maybe that keyframe was the problem.  it could have been part of a tween or something else.

 

i didn't search the fla history trying to figuire it out.

 

anyway, i moved those 5 or so textfields to the layer above.  i changed nothing else.  i group selected them, cut and pasted in place after creating a blank

...
Translate
Community Expert ,
May 29, 2025 May 29, 2025

use console.log to debug 

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
Contributor ,
May 29, 2025 May 29, 2025

Thanks, I have and it makes no sense. 

 

Uncaught TypeError: Cannot set properties of undefined (setting 'text')

 

this.PC2.text = AA2_PC2;

 

PC2 does exist and so does the variable. Nothing about the console log is helpful. 

I tested this in Animate 2205 with the same results. 

 

What on Earth could be the issue? 

 

Thanks again. 

 

 

 

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
Contributor ,
May 29, 2025 May 29, 2025

If the console log error made sense, why is the variable I assigned to sctn_HDR showing up in PC2 if 'text' is undefined for PC2?  

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 ,
May 29, 2025 May 29, 2025

Hi.

 

Have you double-checked in the Properties panel if the instances names are assigned as you expected? Or maybe if you have other hidden/forgotten instances with the same name?

Please let us know.

 

Regards,

JC

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
Contributor ,
May 29, 2025 May 29, 2025

The properties are correct, I always place the instance name in the field as a placeholder for clarity.

JefferyWright_0-1748530203311.pngJefferyWright_1-1748530235357.pngJefferyWright_2-1748530250506.pngJefferyWright_3-1748530262216.png

 

What could possibly cause variables I assigned to appear where I didn't assign them? It's crazy. 

 

Thanks. 

 

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 ,
May 29, 2025 May 29, 2025

do the dynamic textfields exist (even if differently named) on any frame prior to the frame with code?

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
Contributor ,
May 29, 2025 May 29, 2025

The objects AA2_Copy, PC1, 2 and 3 are unique to this frame. 

 

sctn_HDR appears on other frames and is populated correctly.

 

Why would adding new DynText objects to a frame cause variables to be assigned where they don't belong? 

 

Thanks. 

 

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 ,
May 29, 2025 May 29, 2025

delete the problematic textfields, and then recreate and name them.

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
Contributor ,
May 29, 2025 May 29, 2025

Did that, no dice, I even changed the font to _sans in case embedding was an issue.

 

JefferyWright_0-1748531540672.pngJefferyWright_1-1748531572907.png

This can't just be happening to me, no  one else has run into this? 

 

Thanks. 

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 ,
May 29, 2025 May 29, 2025

PC2 doesn't exist on the frame that contains the code.

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
Contributor ,
May 29, 2025 May 29, 2025

It certainly does exist, all the Dynamic text fields are on the same frame that contains the code. 

JefferyWright_0-1748532481878.png

 

The whole thing doesn't make sense... this is simple javascript. It should work.

 

Thanks. 

 

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 ,
May 29, 2025 May 29, 2025

above your code put:

 

console.log(this.PC1);

console.log(this.PC2XX);

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
Contributor ,
May 29, 2025 May 29, 2025

Thanks, 

 

console.log(this.PC1); produced quit a bit of info.

console.log(this.PC2); produced "undefined"

 

JefferyWright_0-1748534022712.png

 

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 ,
May 29, 2025 May 29, 2025

comment out

 

this.PC2.text = AA2_PC2;

 

and retest with those console.log's

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
Contributor ,
May 29, 2025 May 29, 2025

console.log(this.PC2); still results undefined, an the issue cascaded to the next text field... its maddening. 

 

JefferyWright_0-1748535223817.png

Thanks!

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 ,
May 29, 2025 May 29, 2025

working...

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
Contributor ,
May 29, 2025 May 29, 2025

I really appreciate your expertise, 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 ,
May 29, 2025 May 29, 2025

check private message for corrected fla

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
Contributor ,
May 29, 2025 May 29, 2025

How did you do it? What did I miss? Yoou're a miracle worker!

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 ,
May 29, 2025 May 29, 2025

all those dynamic textfields were in a problematic layer.  why it is problematic, i don't know.  it may have been a guide layer previously or a camera layer or hidden or something else.  or maybe that keyframe was the problem.  it could have been part of a tween or something else.

 

i didn't search the fla history trying to figuire it out.

 

anyway, i moved those 5 or so textfields to the layer above.  i changed nothing else.  i group selected them, cut and pasted in place after creating a blank keyframe in the above layer.

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
Contributor ,
May 29, 2025 May 29, 2025

Is it that the text fields have to be in the layer above the scripting? So they load first? 

I don't understand why then the other frames have no problem loading the variables into the text... I really appreciate your help on this. Thank you so much!

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 ,
May 29, 2025 May 29, 2025
LATEST

no, they do not need to be in an above layer.  the assets are loaded on any particular keyframe and then the code executes.

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
Contributor ,
May 29, 2025 May 29, 2025

In this frame I changed the variable name of sctn_HDR to sctn_HDRX to test. 

Now the header populates... but PC2 and PC3 don't populate... how does this make sense? 

 

JefferyWright_0-1748530961806.png

 

Console log is no help again...  TypeError: Cannot set properties of undefined (setting 'text')

JefferyWright_1-1748530986963.png

 

Again, AA2_PC2 does exist. 

 

Changing PC2 to PC2X = the same result... 

JefferyWright_2-1748531221515.png

 

JefferyWright_3-1748531249327.png

 

Pretty baffling... 

 

 

 

 

 

 

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
Contributor ,
May 29, 2025 May 29, 2025

I deleted the text field and commented out it's line, and now the previous text field is an issue... it's like a reverse cascade error... 

JefferyWright_0-1748531899030.pngJefferyWright_1-1748531912933.png

 

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