Variables to load specific pages?

I was wondering how you pass variables through AS, lets say there are 3 buttons on the main stage and the movie is stopped. Each button will will do the same thing and play the main timeline, but assign a new value to a set variable. At the end of the time line would be a script to act depending on what value has been set to the variable.

I have done similar thing in Directors Lingo which was quite simple but when I try something similar in Flash AS it never works.

Any sample scripts, tutorials on the subject or relevent info is appreciated.