Hi all,
I have one of those pesky TypeError: Error #1010: A term is undefined and has no properties - errors…
I know what 2 lines are causing it, but the lines from what i can tell are coded properly…
First, I set a variable to a string inside of a for loop
var buttonName:String = "btn"+i;
then later, i basically call each button and position it like so:
mc_name.otherMc_name[buttonName].x = 15;
mc_name.otherMc_name[buttonName].y = 1000;
basically I’m targeting the instance name btn1, btn2, btn3 in the for loop and positioning them
But the 2 lines above that use the square brackets are causing the error 1010 - if i swap out the string/instance name in [brackets] and hard code the actual button instance name like so:
mc_name.otherMc_name.**btn1**.x = 15;
that particular button not only positions itself fine but the error goes away… when i use the brackets everything works as it should, but i get the pesky error. Why would something that far as i can tell is coded correctly throw an error?
If it were looking for an instance name that didn’t exist could that cause the issue? (so in an array it starts counting from 0, and i have 20 buttons, so i should actually be counting to 19, not 20… and if the code is looking for the 20th button instance name could that cause the issue?)
any help is appreciated! just trying to be a clean coder here