I've made a game where the you catch things that each have
their own individual score, when you catch one, a card appears
showing details of that thing (displayClip). In this displayClip
there is a dynamic text box that has the amount that the thing is
worth for the score. This then gets sent to to final score.
Everything is working just how it should EXCEPT for the fact that
the amount just get's exchanged with the last amount, not added to
it ?!?! I thought " score += Number(a); " would do it... any one
with an idea of why it is not adding up? Would very much appreciate
var displayClip = attachMovie(thing.style, thing.style, d);
var a = displayClip.amount.text;
var score = 0;
score += Number(a);
total.text = score +" kr.";
Make sure you are not setting var score = 0 every time
otherwise if the score is 5, for example, if you get 5 more points
the score will be set back to 0 before the points are added - which
would result in the problem you are having. declare the variable
outside the function.
Otherwise post the full script or a link to the fla
Thanks so much to both of you! Yep it was the fact that it
was being re-set back to 0 every time... so now I moved the var
score = 0 to the beginning of my script instead of in the function.
Works beautifully now - Cool!