[MX2004] problem with displaying numeric variables

hey there,

I’m new to this forum, and new to flash MX (I have used flash 4 back in the days, but that was about 3 or 4 years ago, so my knowledge has sadly disappeared). But I know a little javaScript, so I do vaguely understand most of the Action Script commands… just don’t know how to use them.

I am working on a file that displays two variables, a and b. The two variables are percentages, and they both start at value 50.
Now what i want to do is to display both variables, and when the user presses the ‘up’ key a should go up and b should go down. When the user presses the ‘down’ key, it should be the other way around. And a+b= always 100.

I made this little action script:

[FONT=Courier New]
var a:Number = 50;
var bNum:Number = 50;
if(Key.getCode() == Key.UP) {
return a;
return b;}

if(Key.getCode() == Key.DOWN) {
return a;
return b;}[/FONT]

Then I’ve made two text areas, both in their own layer. I’ve put them both on ‘dynamic text’ and where it read ‘Var:’, I have entered ‘a’ for the first and ‘b’ for the second. In both text areas, I entered ‘50’

Obviously, it doesn’t work. I test the movie, and nothing happens when I press the ‘up’ or ‘down’ keys.

If anyone could please help me out…!