0
Animate CC Canvas reference instance with variable
New Here
,
/t5/animate-discussions/animate-cc-canvas-reference-instance-with-variable/td-p/11530715
Oct 22, 2020
Oct 22, 2020
Copy link to clipboard
Copied
I have multiple symbols on the main timeline with incremental instance names : player1, player2, player3
How can I reference these symbols with a string variable?
currentPlayer = 1
"player"+currentPlayer would reference "player1" for example
Is there a way to programatically reference these instances with a string variable? Or is there another way to reference these symbols without explicity calling them by name?
thanks!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/animate-cc-canvas-reference-instance-with-variable/m-p/11530751#M336507
Oct 22, 2020
Oct 22, 2020
Copy link to clipboard
Copied
Hi.
Use bracket notation. For example:
this["player" + currentPlayer].play();
Regards,
JC
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/animate-cc-canvas-reference-instance-with-variable/m-p/11530828#M336508
Oct 22, 2020
Oct 22, 2020
Copy link to clipboard
Copied
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
kevinkevinkevin1213123123
AUTHOR
New Here
,
/t5/animate-discussions/animate-cc-canvas-reference-instance-with-variable/m-p/11530842#M336509
Oct 22, 2020
Oct 22, 2020
Copy link to clipboard
Copied
Got it! it is
this["player"+i].score
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
kevinkevinkevin1213123123
AUTHOR
New Here
,
LATEST
/t5/animate-discussions/animate-cc-canvas-reference-instance-with-variable/m-p/11530844#M336510
Oct 22, 2020
Oct 22, 2020
Copy link to clipboard
Copied
Thanks for the replies!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

