Hello. I have dynamic text (the number '6' in the following image) that decrements by 1 every time the user presses the Enter key (as can be seen in code within the second image).
If I make the dynamic text a symbol such as a MovieClip, the number no longer decrements on stage but the variable does within the code. How do I reference the dynamic text within the MovieClip symbol within my code so it decrements as it originally did on stage?
select the movieclip (that contains your textfield) and note its instance name in the properties panel. (if it doesn't have a name, assign one. eg, tf_mc)
you can then use:
tf_mc.shotstat to reference the shotstat textfield that's a child of tf_mc from the timeline that contains tf_mc. ie,
tf_mc.shotstat.text = String(shots);
in your key_up method (assuming that code is on the timeline that contains tf_mc)
Thanks for your help. However, I get this compiler error:
I named the 'linkage' of the MovieClip to tf_mc and refered to it within the code but I don't know what the error message means. Any ideas?
I trimmed down the code after the compiler error. Line 51 is now Line 12.
and what's the result of that change?
It still won't work. This is the code I have, the compiler error and the MovieClip the dynamic text is in:
I did it! I got it wo work. I had refered to the MovieClip as a varaiable 'sc' earlier in my code so I used this in the line:
sc.shotstxt.text = String(shots);
and it works great.
Thanks for you help.