Adding numbers to a total

Hello Kirupa!
For a long time I’ve used the free tutorials on this website; thanks alot for sharing top notch tuts to us deadly! :slight_smile:

Disclaimer: I’m a total newbie when it comes to the actionscript-skills needed to solve the following problem, so please, however easy it might be - do not flame me :smiley:

Now to my problem:
Say I have 4 values (level_reached1, level_reached2, level_reached3, level_reached4) I want to add up to a total, and another 4 values (goal1, goal2, goal3, goal4) I want to add up to a total. How do I add these up and compare them to each other, and if the “level_reached” is equal to OR greater than “goal” I want a movie to gotoAndStop(2);

Here is what I have, which does not work, I probably have things really mixed up:

leveltotal = level1 + level2 + level3 + level4;
goaltotal = goal1 + goal2 + goal3 + goal4;

if (leveltotal >= goaltotal) {

In advance, thanks :slight_smile: