For best flexibility you'll want probably want to consider tracking a few different kinds of data:
- Simple counters. Used as you described to count the number of times something happens. Common examples might be kill counts, pick-ups, or repeating some action a certain number of times. All you need to do is increment the stored value, and once it reaches a certain threshold the achievement is unlocked.
- Timers. If your game has sections or levels, you can time how long the player takes to complete each, and store the lowest value each time. You can then set goal times, and perhaps even have different rankings for bronze, silver and gold completion times. This is marginally more complicated than just counting a value, but not overly difficult as long as you have access to some sort of timing function, and it's a pretty popular type of achievement in games where it is appropriate.
- Conditions under which a certain goal is accomplished. You might for example have an achievement for completing an entire level using only the most basic weapon. This is again a little more complicated than either timing or value-counters, but can potentially offer more interesting goals. You would most likely implement this using a series of flags; considering my example of completing a level using only the basic weapon, you would store a boolean value that is initially set to false and changed to true as soon as the weapon is changed. At the end of the level or game play section, you then check if your boolean has been toggled and award the achievement if appropriate. Obviously this type of achievement is very specific to your game play, and harder to generalise than the above options.
If you're developing Flash games, it's worth noting that you could choose to embed an existing system such as the Mochi Achievements API (check the developer section, they have a number of other useful tools as well.), or if you're publishing on certain platforms they might provide their own achievements API such as the one provided by Kongregate. Even if you choose not to make use of these options, it might be worth having a look at the functionality provided to get ideas for your own system.
Hope that's helpful!
: : Elaboration.