Hi, I was just wondering if anyone could help me out.
Basically, I'v created a dynamic text on the main timeline
with an instance name of "score". I then created a button within 2
movie clips. The idea is that when the button is pressed, I add to
the score. The code I'm using on the button is
I'm not an experienced actionscripter, I was wondering if
anyone could maybe tell me where I'v gone wrong and what to do to
make this work. Thanks xD
Well officially the .text property of a textfield is a string
so what will happen is that the 20 gets turned into string and
concatenated (or appended) the the string value in the text
Can you clarfify the problem? Is your textfield changing or
If it is changing then you will need to do something like:
_root.score.text = Number(_root.score.text)+20;
That requires that a valid number already exists in the
textfield. It might be safer to track the score in a separate
variable and then assign it to the textfield's text property each
time it changes.
If its not changing then try putting a trace in to see what's
If you see 'undefined' then it may just be a typo - perhaps
you called it Score with an uppercase S for example. If its defined
and nothing is visible then it could be that you've embedded fonts
without numbers or something like that.